- Write A C Program To Play The Following Game 1 The Program Begins By Choosing Three Random Numbers Between 3 And 9 I 1 (67.49 KiB) Viewed 25 times
Write a C++ program to play the following game: 1. The program begins by choosing three random numbers between 3 and 9 i
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Write a C++ program to play the following game: 1. The program begins by choosing three random numbers between 3 and 9 i
Write a C++ program to play the following game: 1. The program begins by choosing three random numbers between 3 and 9 inside function "main". Numbers 3 and 9 are included. 2. Then, it calls function "UniqueNumbers" that takes the three randomly generated numbers in step 1 as reference parameters. This function checks if these three numbers are unique. If they are not, then it only regenerates randomly the repeated one until all three numbers are unique. Finally, it returns the three numbers by reference to "main" function. 3. After function "UniqueNumbers" returns control to "main", your program should start a loop that counts to 10, and in each iteration of the loop you should: • Prompt the user to input 3 numbers, and then read these three numbers. • Acting on the user's entered numbers, your program should call function "NumberGuessed" that takes 6 arguments by value. The first three are the numbers generated randomly by the computer in the first step. And the second three are the numbers entered by the user in the previous step. This function should check how many numbers are guessed and returns this value to "main". • Then, your program should call function "Number InOrder" that takes 6 arguments by value. The first three are the numbers generated randomly by the computer in the first step. And the second three are the numbers entered by the user. This function should check how many numbers are in the correct order and returns this value to "main". • Then, your program should tests if the two returned numbers from "NumberGuessed" and "NumberInOrder" are both equal to 3. If yes, then exit loop. 4. Finally, in order to win the game, the user must guess the three numbers and their order within 10 tries. Otherwise the user looses.