Project #82937 - C++

  • Assignment 1: Write a program that generates a random number between 1 and 100 and asks the user to guess what the number is. If the user’s guess is higher than the random number, the program should display “Too high, try again.” If the user’s guess is lower than the random number, the program should display “Too low, try again.” The program must use a loop that repeats until the user correctly guesses the random number or has made 10 guesses. The program needs to keep track of the number of guesses the user makes. At the end the program will display one of the messages in the table below based on the number of guesses the user took. The program must validate the user’s guess by making sure the value entered is between 1 and 100. If the value is not between 1 and 100, the user should be told to make another guess. The invalid input should not count as one of the 10 guesses the user is allowed.

     

    Number of Guesses by the User

    Output Message

    Less than 5 guesses

    "Either you know the secret or you got lucky!"

    5-7 guesses

    "You're pretty good at this!"

    8-10 guesses

    "You'll do better next time."

    If guess 10 is not correct

    "Sorry - You have taken too many guesses."

  • Assignment 2: Working with files – You will need the text file Random.txt that can be found in the Content area of the course under Week 5.  The file contains a list of random numbers. Write a program that opens the file and reads all the numbers from the file, and calculate/determine the following:
  1. Counts how many numbers were read from the file
  2. The sum of all the numbers in the file (a running total)
  3. The average of all the numbers in the file
  4. Determine the lowest and highest values in the file
    • The program must validate that the file was opened before reading from the file.
    • If file does not exist then display a message telling the user that the file could not be opened and exit the program.

Subject Computer
Due By (Pacific Time) 09/20/2015 09:00 pm
Report DMCA
TutorRating
pallavi

Chat Now!

out of 1971 reviews
More..
amosmm

Chat Now!

out of 766 reviews
More..
PhyzKyd

Chat Now!

out of 1164 reviews
More..
rajdeep77

Chat Now!

out of 721 reviews
More..
sctys

Chat Now!

out of 1600 reviews
More..
sharadgreen

Chat Now!

out of 770 reviews
More..
topnotcher

Chat Now!

out of 766 reviews
More..
XXXIAO

Chat Now!

out of 680 reviews
More..
All Rights Reserved. Copyright by AceMyHW.com - Copyright Policy