Get Ascii Value Of Character Program in C++

    1. Home
    2. Tutorials
    3. CPP
    4. CPP Programs
    5. Input Statement
    6. Program

    Source Code

    #include <iostream>

    using namespace std;

    int main(int argc, char** argv) {
        
        // Declaring Character Variable
        char ch;
        // Getting Input in variable ch.
        cout << "Enter any character: ";
        cin >> ch;
        // Printing ASCII value
        cout << "ASCII Value = " << int ( ch );
        
        return 0;
    }

    Output

    print ASCII value of an input character

    Comments
    Login to TRACK of Comments.