help please

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/***********************
Lauren Buecker
Assignment 7
***********************/

#include <iostream>
#include <iomanip>
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 decimal = 33; decimal <=126; ++decimal ){
	  cout << static_cast< int > ( 'a') << endl;
  }/* Write a for header that will iterate from 33 through 126*/
 /* Write an output statement to output the current ASCII value in decimal, octal, hexadecimal and character formats; follow the spacing convention established above */
  system("pause");
	return 0;
} // end main 
I see no question.
closed account (3bfGNwbp)
oh sorry, i wanted you guys to fix it.
Line 17 is going to output the same value each time through the loop.
I assume your question is how to

/* Write an output statement to output the current ASCII value in decimal, octal, hexadecimal and character formats */

?

If so, take a look at std::dec, std::hex etc. I won't solve your homework for you, but something like

cout << std::hex << static_cast<int>('a') << endl;

is quite close to the truth (hint hint)
Topic archived. No new replies allowed.