I have a few questions that I would like to address altogether:
1. Is there a proper way to print ASCII codes? I saw on other forums that they used this syntax:
cout<<(char)0;
But it looks messy if I want to print many of these characters. And do we use octal codes only?
2.
a) What is the difference between cout, printf, and cprintf? And which libraries are they defined in?
b) What is the difference between cin, scanf, and cscanf? And which libraries are they defined in?
3. Where can I find a complete list of ASCII codes? (Including rare symbols such as "heart")
If you use the right type of variable, the printed value will match the type:
1 2 3 4 5 6 7 8 9
char w = 'A';
int x = 66;
char y = 67;
int z = 'D';
cout << w << endl;
cout << x << endl;
cout << y << endl;
cout << z << endl;
A
66
C
68
Usually you will be interested in the decimal or hexadecimal values. Octal is less common.
cout, printf, and cprintf?
cin, scanf, and cscanf?
cin and cout are C++, found in the <iostream> library.
The others are belong to C, in <stdio.h>
cprintf and cscanf are non-standard console-versions which you may find in <conio.h>, but neither the file nor its contents are standardised and may not be available on a given compiler.
As for the list of ASCII codes, Google will help. Be aware that the extended codes for special symbols will depend upon the character set in use, and the displayed symbol may vary.
@Chervil Thanks for your reply. I really appreciate them;most of them answered my questions. But about no. 1, if I print something like a poundsterling symbol, what is the proper syntax? I'm still confused on how to properly print special ASCII symbols using "cout".
Note that the actual characters which are displayed will depend on the code page in use, which may depend on the operating system and how the machine is configured. That's a whole additional topic, and can be a cause of issues too.