Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In this exercise, you will modify the guessing game program from Figure 9-11 in Chapter 9. Follow the instructions from starting C++ and viewing the

In this exercise, you will modify the guessing game program from Figure 9-11 in Chapter 9. Follow the instructions from starting C++ and viewing the Introductory15.cpp file, which is contained in either the Cpp8\Chap10\Introductiory15 Project folder or the Cpp8\Chap10 folder. (Depending on your C++ development tool, you may need to open this exercises project/solution file first.) Modify the program so that it uses a void function to determine the random number. The program should ask the user for both the minimum and maximum random numbers that the void function should generate. The function call should pass that information to the void function. test the application appropriately.

Figure 9.11 from Ch9

#include "stdafx.h"

#include

#include

#include

using namespace std;

int main()

{

int randomNumber = 0;

int numberGuess = 0;

//generate a random number from 1 through 10

srand(static_cast(time(0)));

randomNumber = 1 + rand() % (10 - 1 + 1);

//get first guess from user

cout << "Guess a number from 1 through 10: ";

cin >> numberGuess;

while (numberGuess != randomNumber)

{

cout << "Sorry, guess again: ";

cin >> numberGuess;

} //end while

cout << endl << "Yes, the number is "

<< randomNumber << "."

<< endl;

return 0;

} //end of main function

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

HOW MANY TOTAL WORLD WAR?

Answered: 1 week ago

Question

Discuss the scope of financial management.

Answered: 1 week ago

Question

Discuss the goals of financial management.

Answered: 1 week ago