Having trouble with an assignment. Was looking for some advice...
Objectives: using the iomanip library to format screen output.
Complete the provided main() program with statements to accomplish each of the following. In each case you must use the appropriate I/O stream manipulators to produce the appropriate output wherever possible. Refer to the sample output below as a guide for proper output alignment.
1. Output first first as an integer value, followed by a space, then in its written form.
2. Output second as a base ten value, followed by a space, then as a hexadecimal value, followed by a space, then as an octal value. Make sure the appropriate base indicator prefix is shown in the output.
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 26 27 28
|
#include <iostream>
#include <iomanip>
using namespace std;
int
main()
{
bool first;
int second;
long third;
float fourth;
float fifth;
double sixth;
cout << "Enter bool, int, long, float, float, and double values: ";
cin >> first >> second >> third >> fourth >> fifth >> sixth;
cout << endl;
// ***** Solution starts here ****
//1
cout << first << " true"
//2
cout << second << setbase(10) << setbase(8) << setbase(16);
// ***** Solution ends here ****
cin.get();
return 0;
}
|
We're using a test driver in the compiler. But my answers are not aligning with instructors answers.
Not looking for answer. Just looking for help. Need pointed in the right direction. Any advice would be greatly appreciated.
Thanks..