[vc_row][vc_column][vc_column_text]
C++ program to print ASCII values
We know what are ASCII values? There are 256 characters, and we know most of them are not available on keyboard. If we want to use them in a program, we need to know their ASCII values.
This program I wrote can help you find the ASCII values of all the 256 characters. This program has following features:
- Show the ASCII values along with the character (So you can see which is useful character to be used in programs or projects to have a better impact.
- Since all 256 characters displayed all in once will clutter the screen, program creates a window to displays 10 at a time. You can press any key to move on to next set.
#include<iostream.h> #include< conio.h> void main() { int n=0, ctr=0; clrscr(); while(n<=255) { if(ctr<10) { cout<<"\n\n"<<n<<" -> "<<(char)n; n++; ctr++; } else { ctr=0; cout<<"\nPress any key for next screen"; getch(); clrscr(); } } }
[/vc_column_text][/vc_column][/vc_row][vc_row][vc_column][vc_column_text]Look out for special characters for example : “⌈”, “⌉”,”⌊” and “⌋” along with few other characters that can be used in projects to print well connected box. Boxes and Lines can be used to enhance the looks of your projects.
Lets say ASCII value of “⌉” is 191, then this character can be printed by simple syntax:
cout<<(char)191;
[/vc_column_text][vc_message]I will share some code on how to display a ‘Box’ or a ‘Line’ using these special characters in one of the upcoming posts.[/vc_message][/vc_column][/vc_row]