Name: ____________________________________________________ Alpha: _____________________
Describe help received: _________________________________________________________________
Turn in: a printout of your source code & a
screencaptrue of the output of your program on this input
In the code below, what would normally cause
the program to exit the while loop, and what exceptional
condition would cause the program to never enter the while loop?
int count = 0;
char c = 'x';
if (c == '?')
count = count + 1;
fin >> c;
cout << count << endl;
Assume the following delcarations fill in the table.
int n = 5;
double x = 1.5;
char c = 'R';
cin >> x
cin >> c && c != '.'
fin >> n ? n*0.5 : n*0.75
The code below is supposed to add up all the integers in a
file. However, it doesn't compile. Annotate the code to
fix this error so that it compiles.
cout << "Enter file name: ";
cin >> fname;
int sum = 0, next;
while(fin >> next)
sum = sum + next;
cout << sum << endl;
file named by the user consisted solely of the line
what would the above program (once fixed!) output ?
Write a program that reads in a file like
input.txt that contains the names of
several students along with their hw, quiz and exam averages
out the names of the students followed by their overall
given the weighting 20%, 20% and 60%, respectively.
For example, on input.txt the program
Your program should work for any file in the same format,
though you may hard-code the filename, rather than read it in
from the user if you prefer.