Algorithm


1. Start
2. Declare a variable to store the character.
3. Prompt the user to enter a character and store it in the variable.
4. Convert the character to its ASCII value using type casting or a library function.
5. Display the ASCII value.
6. End

Code Examples

#1 Code Example- C++ Programing Print ASCII Value

Code - C++ Programming

#include <iostream>
using namespace std;

int main() {
 char c;
 cout << "Enter a character: ";
 cin >> c;
 cout << "ASCII Value of " << c << " is " << int(c);
 return 0;
}
Copy The Code & Try With Live Editor

Output

x
+
cmd
Enter a character: p
ASCII Value of p is 112
Advertisements

Demonstration


C++ Programing Example to Find ASCII Value of a Character-DevsEnv