C++ program to print ASCII value of characters.
C++ Program to print ASCII value of a character
#include <iostream> using namespace std; int main() { char c; cout << "Enter a Character\n"; cin >> c; // Prints the ASCII value of character cout << "ASCII value of " << c << " is " << (int)c; return 0; }Output
Enter a Character A ASCII value of A is 65
Enter a Character a ASCII value of a is 97
C++ Program to print ASCII value all alphabets
#include <iostream> using namespace std; int main() { char c; // Prints the ASCII value of all Uppercase Alphabet for(c = 'A'; c <= 'Z'; c++){ cout << c << " = " << (int)c <<endl; } return 0; }Output
A = 65 B = 66 C = 67 D = 68 E = 69 F = 70 G = 71 H = 72 I = 73 J = 74 K = 75 L = 76 M = 77 N = 78 O = 79 P = 80 Q = 81 R = 82 S = 83 T = 84 U = 85 V = 86 W = 87 X = 88 Y = 89 Z = 90
Recommended Posts