1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Alinara [238K]
3 years ago
14

Write a program that allows the user to play a guessing game. The game will choose a "secret number", a positive integer less th

an 10000. The user has 10 tries to guess the number.
Computers and Technology
1 answer:
Burka [1]3 years ago
8 0

Answer:

// This program is written in C++

// Comments are used for explanatory purpose

// Program starts here

#include<iostream.h>

#include<stdlib.h>

int main()

{

// Declare variables

int num, selectno;

string status;

randomize();

//Generate random number;

num=rand()%10000;

// Prompt to guess a number

cout<<"You have only 10 tries\nTake a guess: ";

int tries = 0;

while (tries != 10)

{

cin>>selectno;

if(selectno == num){

cout<<"You passed at the "<<count+1<<" attempt";

tries = 10;

}

else

{

cout<<"You failed. Take another guess\n You have "<<10 - count + 1 <<" attempts";

}

tries++;

if(tries >= 10)

{

break;

}

}

return 0;

}

You might be interested in
What refers to the processing of a substance or an object so that it may be used again?
Pavel [41]

Answer:

recycling is the answer

8 0
2 years ago
Read 2 more answers
What file formats can you safely use in a video presentation
dlinn [17]

i use fat 86 try it ok

7 0
3 years ago
Quick SearchLinks to an external site. lets you refine or narrow your search results using links on the right side of the screen
nikdorinn [45]

Answer:

Answer is

By topic, By collection.

Refer below.

Explanation:

Quick SearchLinks to an external site. lets you refine or narrow your search results using links on the right side of the screen. Do a search on wind power. Some criteria that can refine your search results in Quick Search are:

By topic

By collection

5 0
3 years ago
Define a function print_feet_inch_short(), with parameters num_feet and num_inches, that prints using ' and " shorthand. End wit
Crazy boy [7]

def print_feet_inch_short(num_feet, num_inches):

#function named print_feet_inch_short takes in two arguments.

print(str(num_feet)+"'",str(num_inches)+"\"")

#output the feet and inch value supplied with the shorthand sign of feet and inch using string concatenation.

num_feet = int(input())

#allows user to specify a feet value and stores it in num_feet

num_inches = int(input())

#allows user to specify an inch value and stores it in num_inch

print_feet_inch_short(num_feet, num_inches)

#calling the function with the number of feets and inches given by user.

Learn more : brainly.com/question/18318709

4 0
3 years ago
Read 2 more answers
Why computers are called "COMPUTER"?
Lady_Fox [76]

Because it ‘computes’ certain tasks, get it. It’s like saying ‘the puncher’ for someone who punches stuff.

8 0
3 years ago
Other questions:
  • Which of the following is designed to help an organization continue to operate during and after a disruption?
    12·1 answer
  • kevin is working on a financial project that involves a lot of statistical information. He needs software that allows him to ent
    8·2 answers
  • Phoebe has to give a permission about recycling. Where should she look while presenting?
    11·1 answer
  • My mac book airs touch pad stopped working and i can't click. what do i do?
    5·2 answers
  • 12. Kelly would like to know the average bonus multiplier for the employees. In cell C11, create a formula using the AVERAGE fun
    7·1 answer
  • Which is NOT a benefit of using visual aids?
    9·2 answers
  • How to open a new word proccessing document
    9·1 answer
  • Name TanushSAVAGE. As given in the picture, Subscribe!
    15·1 answer
  • True/False: On the piano, middle C is located to the left of the 2 black keys in the middle.
    9·2 answers
  • What kind of skill is persuasion?
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!