Test 3 CSCI 130 Spring 2003


  1. (3 points) Define the type boolean, describe the operations c++ supports on booleans
  2. (3 points) Give the syntax for an if-then-else statement.
  3. (3 points) State the flow of control for an if-then-else statement.
  4. (3 points) Give the syntax for a while statement.
  5. (3 points) State the flow of control for a while statement.
  6. (9 points) The file temp.dat contians a series of floating point numbers that represent the temprature over a period of time. Write a program that will print the average temprature for this time period.
  7. (6 points) Gauss observed that the sum of the first n integers is (n+1)*n/2.

    ie 1+2+3+4 = 10 = 5*4/2

    Write a program which will prove this for all positive integers less than 100