C++ Program To Find ASCII Value Of Character

Write C++ Program to find ASCII value of given character

// Write C++ program to print ASCII value of entered character

#include<iostream>

using namespace std;

int main()
{
    char c;
    cout << "Enter a character :--> ";
    cin >> c ;

    cout << "ASCII value of \'" << c << "\' = " << (int) c ;

    return 0;
}

Output:

Enter a character :–> G

ASCII value of ‘G’ = 71


<< Previous | Next >>