I am just preparing to take a quiz and he said some examples will be kind of like this and I was just tryin to get some input on if these answers I have are the right ones..
he said just do what the statement says, no further work, just little snippets;
1. Output the value of the variable, x, in a field of 10 spaces
cout<< setw(10) << x;
2. Read 2 float values from a stream, inFile, into variables x & y
I'm not sure how to write this one...
3. Increase the value of variable x by variable y
4. Output the value of x and leave the cursor on the same line
5. Add x to y, double it and store the value in z
z= (x+y) * 2;
6. Show the exact output of this code:
x = 7.987654321;
cout << fixed << showpoint
<< setprecision(2) << setw(5) << x;
Write code to:
open a file called data.dat with a stream called myFile
read 3 integers into vars x, y and z
?? is it int x,y,z; ??
calculate the sum and average and store in vars sum and avg
output all 5 values (x, y, z, sum, avg) on 5 separate lines
I'm not sure ??
thanks for your input!!!