Program uses a loop to display the characters for the ASCII codes 0 through 127. 16 characters per line.

I'm supposed to write a program that program uses a basic loop to display the characters for the ASCII codes 0 through 127. 16 characters per line. Does this look right?

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
//
//  ********************************************************************************
//  Description: This program uses a loop to display the characters for the ASCII codes 0 through 127. 16 characters per line.
//  Created on 3/7/15.
//  Status: Complete
#include <iostream>
using namespace std;

int main()
{
	cout << "Characters for the ASCII Codes\n";
	cout << "--------------------------------------\n\n";

	// Loop through the ASCII codes.
	for(int code = 0; code <= 127; code++)
	{
		if ( code %16==0)
		    cout << endl;
		cout << (char)code << "  ";
	}
	cout << endl << endl;

	return 0;
}
Last edited on
Yes.
Topic archived. No new replies allowed.