Advertisement

C++ Program to find the ASCII value of a character


In this program, You will learn how to find the ASCII value of a character in C++.


A - 65, B - 66,  C - 67, D - 68

Example: How to find the ASCII value of a character in C++

#include<iostream>
using namespace std;

int main() {

    char str;
    cout << "Enter a character:";
    cin>>str;

    cout << "ASCII value is:" << int(str);

    return 0;
}

Output:

Enter a character:a
ASCII value is:97