Question: C++ Programming: Answer question 4. question 3 is just related to question 4. The code #include #include #include using namespace std; int main() { srand(time(NULL));

C++ Programming:

Answer question 4. question 3 is just related to question 4.

C++ Programming: Answer question 4. question 3 is just related to question

The code

#include  #include  #include  using namespace std; int main() { srand(time(NULL)); int n1, n2, n3, n4, d; while (true) { cout > d; if(d == -1) break; n1 = 1 + (rand() % d); n2 = 1 + (rand() % d); n3 = 1 + (rand() % d); n4 = 1 + (rand() % d); cout if(n1 == n2 && n1 == n3 && n1 == n4) { cout else { cout return 0; }

answer the following question

4. The code #include #include #include using namespace std; int main() {srand(time(NULL)); int n1, n2, n3, n4, d; while (true) { cout >

Problem 3 Write a program that simulates a game in which four wheels spin and randomly stop at a number between 1 and d, where your program prompts the user to enter a value for d. If the four numbers match, print the numbers and "Eureka!". Otherwise, print the numbers and You lose." the process until the value - is entered for d. For example Your program should continue How many values do you want on each wheel? 4 The wheels spin to give 3 2 4 3. You lose. How many values do you want on each wheel? 3 The wheels spin to give: 2 2 2 2. Eureka! How many values do you want on each wheel? 15 The wheels spin to give 14 8 3 12 You lose How many values do you want on each wheel? 1 OK, goodbye. An example program demonstrating how to use the rand ) and srand ()functions to generate random numbers is shown at this web site: http://www.cplusplus.com/reference/cstdlib/rand You can use these functions to randomly generate the values to simulate the spinning of the wheels. You should also define your own functions to make your program easier to write and easier for someone else to understand

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!