To print ASCII values of all the character in C++ programming, use the number from 1 to 255 and place the number in the ch variable of char type to convert the ASCII value in equivalent character to print all the ASCII values of the characters as shown here in the following program.
Following C++ program print all the ASCII values of characters:
/* C++ Program - Print ASCII Values of Characters */ #include<iostream.h> #include<conio.h> void main() { clrscr(); char ch; int i; for(i=1; i<255; i++) { ch=i; cout<<i<<"-> "<<ch<<"\t"; } getch(); }
When the above C++ program is compile and executed, it will produce the following result:
You may like the same program in other programming languages: