Hi,
The excercise I'm trying solving it today is printing the numbers from (32 to 256) and the ASCII values in table, I completed the code but the console appear one value only.. :(
The excercise:
ASCII table
Make a program that writes a table of all characters with values from 32 to 255.
Example:
value character
62 >
63 ?
64 @
65 A
66 B
and so on...
Hint: if you output a variable of type char you will get the corresponging character on the screen. If you output a variable of type int you will get the value as a number on the screen.
my code:
#include <iostream>
#include <iomanip>
#include <conio.h>
using namespace std;
void main()
{ int i=32;
for(i=32; i<=256; i++);
cout << setw(0) << "value" << setw(14) << "character" << endl;
cout << setw(0) << i << setw(10) << static_cast<char>(i) << endl;
getch();
}
my output: