Write a program that uses a for statement to print a table of ASCII values for the characters in the ASCII character set from 33 to 126. The program should print the decimal value, octal value, hexadecimal value and character value for each character. Use the stream manipulators dec, oct and hex to print the integer values.

What will be an ideal response?


```
#include
#include
using namespace std;

int main()
{
// display column headings and set field lengths
cout << setw( 7 ) << "Decimal" << setw( 9 ) << "Octal " << setw( 15 )
<< "Hexadecimal " << setw( 13 ) << "Character" << showbase << '\n';

// loop through ASCII values 33-126 and display corresponding
// integer, octal and hexadecimal values
for ( int loop = 33; loop <= 126; loop++ )
cout << setw( 7 ) << dec << loop << setw( 9 ) << oct << loop
<< setw( 15 ) << hex << loop << setw(13)
<< static_cast< char >( loop ) << endl;
} // end main
```
Decimal Octal Hexadecimal Character
33 041 0x21 !
34 042 0x22 "
35 043 0x23 #
36 044 0x24 $
37 045 0x25 %
38 046 0x26 &
39 047 0x27 '
40 050 0x28 (
...
118 0166 0x76 v
119 0167 0x77 w
120 0170 0x78 x
121 0171 0x79 y
122 0172 0x7a z
123 0173 0x7b {
124 0174 0x7c |
125 0175 0x7d }
126 0176 0x7e ~

Computer Science & Information Technology

You might also like to view...

What kind of screen allows users to take the most advantage of the desktop's ability to display multiple application windows?

A. small screens B. large screens C. tablet screens D. smart screens

Computer Science & Information Technology

What technology can be used to locate a device such as a laptop after it has been stolen?

A. Management software B. LoJack C. Trojan D. Multifactor Trace software

Computer Science & Information Technology

____ is a protocol in the TCP/IP suite of protocols that is used to transport document and other data transmissions over networks and the Internet for access by Web browsers.

A. SMTP B. FTP C. HTTP D. ICMP

Computer Science & Information Technology

Describe all activities that must occur in order to produce a Risk Mitigation, Monitoring, and Management Plan.

What will be an ideal response?

Computer Science & Information Technology