Lab 13

For all problems involving random number generation, add code to ensure that each time the program runs, the random number sequence is distinct.

  1. Write a C++ program to that computes the area of a triangle using Heron's formula.
  2. Sample run of program:
    Enter lengths of three sides of triangle: Side 1: 3 Side 2: 4 Side 3: 5 Area of triangle: 6
  3. Write a complete C++ program that does the following:
  4. Sample run of program:
    Enter a number between 5 and 15 (inclusive): 16 Invalid input! Try again: 4 Invalid input! Try again: 6 ************ *8484848484* *8484848484* *8484848484* *8484848484* ************

    Another sample run of program:
    Enter a number between 5 and 15 (inclusive): 5 ********** *73737373* *73737373* *73737373* **********
  5. Write a complete C++ program that lists all numbers that are perfect squares in a range.
  6. Sample partial run of program:
    The perfect squares between 179 and 1270 are: 196 225 256 289 325 361 400

  7. Write a complete C++ program that does the following:
  8. Sample partial run of program:
    All numbers between 1000 and 2435 whose square ends in 56 are: 1016 squared is 1032256 1034 squared is 1069156 1066 squared is 1136356 1084 squared is 1175056 ...
  9. Write a complete C++ program that plays an adding game.
  10. I will ask you five addition questions. Please enter the sum for each. 4 + 10 = 14 15 + 49 = 54 Wrong! The answer was 64 13 + 72 = 85 64 + 3 = 67 99 + 45 = 145 Wrong! The answer was 144 You got 3 correct, 2 wrong.