Homework 11

1. 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 and prints out the names of the students followed by their overall average given the weighting 20%, 20% and 60%, respectively. For example, on input.txt the program should produce:

Brown   71.8
Green   93.8
Jones   82.4
Smith   86.2
Worth   91.2

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. Turn In: a printout of your source code and a screen capture of the output of your program on this input file: test.txt. (Note: producing your output as an HTML-table might not be bad practice for you!)

2.   Assuming the following declarations:
 

            int a = 9, b = 1, c = 2;
            char d = 'z';
            double e = 9.2, f = 1.9;
            ifstream fin;
            string g = "no", h = "yes";
      Fill in the following table, giving the type and value of each expression.

Expression

Type

Value

e / b

 

 

d > 'a'

 

 

g == "no" && a > 5 || c > 5

 

 

a / 4.5

 

 

f  = a * c

 

 

fin >> h

 

Leave Blank