首页 > > 详细

C++ Math Challenge Ghostwriter C/C++ Programming Course,C/C++ Homework Writing,Help With C/C++ E

 

Objective

To learn proper use of conditional statements (if .. else) in the C++ programming language and continue to reinforce our understanding of data types and variables. Namely, how to create, initialize, display and perform basic arithmetic operations on those variables.

Assignment

Write a program in C++ that allows the user to play a math game. If the user chooses to play the game, the program should request three integer numbers to be input. The program should calculate the sum and average of the three numbers, the number with the largest integer value and the number with the smallest integer value. Once the program computes the required information, it should then prompt the user to input what they think the answer is to each of the above computations. The program should then check the inputted answers against the computed answers and inform the user which computations, if any, they answered incorrectly.

If the user chooses not to play, the program should accuse them of being afraid of being beaten by a program and suggest they be brave next time.

The program should work as follows:

  • Display a welcome message and challenge the user to play a math game.
  • If they accept the challenge,
    • Prompt the player to enter his or her first name.
    • Prompt the player to enter three numbers.
    • Compute the required information.
    • Prompt the user for their answers.
    • Compare the inputted answers to the computed answers and inform the user of the results.
    • Congratulate the player for being brave.
  • If they do not accept the challenge, let them know what you think.

Challenge

  1. Keep track of how many answers were answered correctly and incorrectly and display a summary at the end of the program.
  2. Change the final display message to be vary based on how many questions were ansered incorrectly. For example, Brilliant if all questions were answered correctly or, Consider a math tutor if no questions were answered correctly or, something in between!
  3. Create a range that the three numbers must fall within and only continue with the game if all three numbers entered are within the range.

Following is one possible sample run, but feel free to be creative:

Welcome to Math Challenge CISC 1600!  My name is Christine and I challenge you to test your math skills.  Do you accept my challenge (yes/no)? yes   You are a brave soul! Who am I playing with? Larry  Thank you Larry, you must have gotten much confidence from all the pizza you ate!!!!  Here we go!    Enter three numbers: 200 100 300  Thank yoy Larry, you entered: 200, 100, 300    Guess the sum? 600  Guess the average? 300  Guess the largest? 100  Guess the smallest? 300    Sorry Larry,  The correct answer for largest number is 300  The correct answer for smallest number is 100  The correct answer for average is 200    Thank you for playing!  

Important

  1. Follow an incremental approach in writing your program. In other words, write a few lines of code, make sure it compiles and executes as expected, then continue with more code.
  2. If the program compiles but does not work as expected, consider using cout statements to display the value of variables in order to identify the errors.

For full credit be sure to:

  • Include a descriptive Comment Block.
  • Use correct indentation and allignment.
  • Use descriptive identifiers for variable names as well as appropriate data types.
  • Use blank lines to separate the code into appropriate blocks.
  • Include comments to help others understand your program, and help yourself think!
联系我们
  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-21:00
  • 微信:codinghelp
热点标签

联系我们 - QQ: 99515681 微信:codinghelp
程序辅导网!