C++ program to convert a given character to its corresponding ASCII value has been shown here. The algorithm, pseudocode and time complexity of the program can be found here. Find here the flowchart of the problem.
Page content(s):
Additional content(s):
1. C++ Program & output for Character to ASCII Conversion
Code has been copied
/******************************************** alphabetacoder.com C++ program for character to ASCII conversion *********************************************/ #include <iostream> using namespace std; int main() { //declare variables char x; int v; //take input of the character cout << "Enter the character = "; cin >> x; //convert and store ASCII value of the character v = (int) x; //print result cout << "\nASCII value of " << x << " is = " << v; return 0; }
Output
Case 1:
Enter the character = b
ASCII value of b is = 98
Case 2:
Enter the character = F
ASCII value of F is = 70