So for my home work assignment we were asked to make four columns of data where there is the decimal, octal, hex, and character equivalents of the letters a-z.
int // introduce the main program
main()
{
int var; // Introduce var1 as a varrible
var=65; // Set inital value of var1 to be 65
cout.setf(cout.left);
cout << setw(10); // Set Width to 10 Characters
cout << "Decimal"; // "Decimal" Column Title
cout << setw(10); // Set Width to 10 Characters
cout << "Octal"; // "Octal" Column Title
cout << setw(10); // Set Width to 10 Characters
cout << "Hex"; // "Hex" Column Title
cout << setw(10); // Set Width to 10 Characters
cout << "Char"; // "Char" Column Title
cout.setf(cout.left);
cout << "\n";
for (int i = 1; i <=26; i++) // For Loop: Run the loop 26 times.
{
int printf( const char *format, ... );
cout.setf(cout.left); // Left Justification
cout << setw(10); // Set Width to 10 Chracters
cout << var; // Display var (Decimal)
cout.setf(cout.left); // Left Justification
cout << setw(7); // Set Width to 10 Chracters
cout << printf("%-o",var); // Display var as an Octal Number
cout.setf(cout.left); // Left Justification
cout << setw(8); // Set Width to 10 Chracters
cout << printf("%-X",var); // Display as a Hexidecimal Number
cout.setf(cout.left); // Left Justification
cout << setw(7); // Set Width to 10 Chracters
cout << printf("%-c",var); // Display as an Alphabetical Chracter
cout << "\n"; // Begin a new line
var = var+1; // Increase the value of var by one
}
Return:0;
}