Assignment 4 for CSCI 201

Description:

In this assignment, you are asked to write two programs. The first program is described in your text, and the second program is described below.

Program 1:

(worth 15 points)

Write the program described in Exercises 6.29 and 6.30 on page 307 of your text.

Program 2:

(worth 10 points)

Write a program that plays the game of "guess the number" as follows: Your program chooses the number to be guessed by selecting an integer at random in the range 1 to 1000. The program then types:


   I have an integer number between 1 and 1000.
   Can you guess my number?
   Please type your first guess.

The player then types a first guess. The program responds with one of the following:


   1. Excellent! You guessed the number!
      Would you like to play again (y or n)?
   2. Too low.  Try again.
   3. Too high. Try again.

If the player's guess is incorrect, your program should loop until the player finally gets the number right. Your program should keep telling the player Too high or Too low to help the player "zero in" on the correct answer. If the player guesses the number correctly, and chooses to play again, your program should respond correctly.

What to turn in:

You should turn in a floppy disk containing both programs at the start of class two weeks from the assignment date. The disk should be labeled (on the outside) with your name and section number. The disk should contain either a cleaned workspace for each part of this assignment (each program should have its own workspace, i.e., project folder) or you can turn in just the C++ source code for each of the programs described above. Either format will be accepted.