Homework 1

The homework is due on Monday, April 10, 2006 at 8pm.

UPDATE: Homework is now due at 8pm due to problems with Helios on the afternoon of the 10th.

Name your files hw01_<problem>.cpp. Email all files to my Helios account.

  1. Write a program that outputs the minimum of two integers. The user should be prompted to enter both integers.
  2. Modify your previous answer to output the minimum of three integers that have been entered by the user.
  3. From the book, Programming Project 2.6 on page 105:
    Write a program that determines whether a meeting room is in violation of fire law regulations regarding the maximum room capacity. The program will read in the maximum room capacity and the number of people to attend the meeting. If the number of people is less than or equal to the maximum room capacity, the program announces that it is legal to hold the meeting and tells how many additional people may legally attend. If the number of people exceeds the maximum room capacity, the program announces that the meeting cannot be held as planned due to fire regulations and tells how many people must be excluded in order to meet the fire regulations.
    Do the harder version that allows the calculation to be repeated as long as the user answers 'y' to the prompt "Do you wish to run the calculation again? [y/n]". Hint, see Display 2.14.
  4. Write a simple menu program that prints the following to the screen:
      Welcome to the CS221 Homework 1 Menu
      ====================================
      1.  Multiple two integers
      2.  Divide two integers
    
      0.  Exit
      ====================================
      Enter selection:
    
    The program should print this to the screen and read in the user's menu selection. If the selection is 1, prompt the user for two integers and print the multiplication to the screen. If the selection is 2, prompt the user for two integers and print the division to the screen. If the selection is greater than 2, tell the user that is not a valid selection. Loop doing this menu until the user enters 0.