Still plugging away....

I am down the last part of my assignment. Question 6 seemed easy enough, however I was confused by the cout << fixed << setprecision(1); should I assume that things will show up one space out from the left of the screen? When I put it all into the compiler I got errors until I removed the cout << fixed << setprecision(1); line. I have posted my answers for question 6 (The _ is for space.)
Question 5 leaves me at a loss. I put what I think the answer is but it just seems wrong, any thoughts on this?

5. Suppose numb and value are int variables and letter is a char variable. Consider the following input:
5 28 36
What value, if any, is assigned to numb, value and letter after each of the following statements executes? (use the same input for each statement)
a) cin>>numb >> value>>letter; 5 28 36
b) cin >> letter >>numb >> value; 36 5 28
c) cin >> numb >> letter >> value; 5 36 28

6. Given the following declarations:
int numb =5;
double amt=15.68;
cout << fixed << setprecision(1);

What is output from the following?

a) cout<< setw(5) << numb << endl; _ _ _ _5
b) cout << setw(3)<< amt << endl; 15.7
c) cout << numb <<amt<< endl; 515.7
d) cout << left << setw(5) << numb << setw(5) << amt; 5_ _ _ _15.7
5.) Here is some info on how >> works:
For integers - It will eat all leading whitespace until it reaches a number, then reads the whole number
For characters - It will eat one character (no matter what it is)

Try drawing out the input as individual characters and trying to act like you are the computer trying to read it.

6.) Once you read this, you should be able to do this problem:
http://www.cplusplus.com/reference/iostream/manipulators/
Topic archived. No new replies allowed.