Homework 4 - Chapter 6

Due Monday, October 30, 2006 at 5pm.

Name your files hw4_<problem>.cpp, such as hw4_1.cpp. Email all the cpp files to my Helios account.

You can copy any of the sample input files to your current directory using

cp /usr/users/mdanfor/public_html/cs221-f06/<filename> .
  1. Write a program that reads in a file containing only numbers of type double and that prints the maximum and minimum numbers from the file to the screen.

    Use the following files as input: hw4_input1 hw4_input2

  2. From the book, Programming Project 6.4, page 368
    Write a program that takes its input from a file of numbers of type double. The program outputs to the screen the average and standard deviation of the numbers in the file. ...
    Use the following files as input: hw4_input1 hw4_input2

  3. Write a program that reads in a text file and normalizes the data. The normalized output will be written to another file. To normalize the data, do the following:

    Use the following files as input: hw4_input3 hw4_input4

  4. Modify the class menu program to work on an array as follows. The menu will print this to the screen:
      Welcome to the CS221 Homework 4 Menu
      ===============================================
      1.  Enter a list of integers from the keyboard.
      2.  Read a list of integers from a file.
      3.  Multiply all integers in the list.
    
      0.  Exit
      ===============================================
      Enter selection:
    
    The list read in by either option 1 or 2 should be saved in an array. Use this saved array to do option 3. Option 3 should print out an error if it is selected before input is given (via option 1 or 2).

    Use the following files as input to option 2: hw4_input5 hw4_input6