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]
2 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]2 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
US-CERT is a set of moderated mailing lists full of detailed, full-disclosure discussions and announcements about computer secur
n200080 [17]

Answer:

False

Explanation:

BugTraq is a high volume, full disclosure mailing list for the detailed discussion and announcement of computer security vulnerabilities, not US-CERT

3 0
2 years ago
Using more than one array to store related data is called _____________ arrays.
Makovka662 [10]
It is called matrix arrays
6 0
2 years ago
Read 2 more answers
Write a program that initializes an array with ten random integers and then prints four lines of output, containing (Horstmann,
Amiraneli [1.4K]

Answer:

import java.util.Scanner;

import java.util.Random;

public class Solution

{

public static void indexEven(int[] randomNumbers)

{

System.out.print("Even index elements are: ");

for (int i = 0; i < randomNumbers.length; i++)

{

if (i % 2 == 0)

{

System.out.print(randomNumbers[i] + " ");

}

}

System.out.println();

}

public static void evenelement(int[] randomNumbers)

{

System.out.print("Every even element: ");

for (int i = 0; i < randomNumbers.length; i++)

{

if (randomNumbers[i] % 2 == 0)

{

System.out.print(randomNumbers[i] + " ");

}

}

System.out.println();

}

public static void reverseOrder(int[] randomNumbers)

{

System.out.print("All elements in reverse order: ");

for (int i = randomNumbers.length - 1; i >= 0; i--)

{

System.out.print(randomNumbers[i] + " ");

}

System.out.println();

}

public static void firstLast(int[] randomNumbers)

{

System.out.print("First and last elements are: ");

System.out.print(randomNumbers[0] + " " + randomNumbers[randomNumbers.length - 1]);

System.out.println();

}

public static void main(String[] args)

{

// create instance of Random class

Random rand = new Random();

System.out.print("Array: ");

int[] randomNumbers = new int[10];

for (int i = 0; i < randomNumbers.length; i++)

{

randomNumbers[i] = rand.nextInt(100);

System.out.print(randomNumbers[i] + " ");

}

System.out.println();

indexEven(randomNumbers);

evenelement(randomNumbers);

reverseOrder(randomNumbers);

firstLast(randomNumbers);

}

}

Explanation:

8 0
3 years ago
You need to create the directory /var/oracle/database/9i. only the directory /var currently exists. from the root of the filesys
egoroff_w [7]
To create a directory, you can use the command mkdir. Below is an example:

mkdir /var/oracle/database/9i
3 0
3 years ago
Can somebody show me
OLEGan [10]
So you are gonna read that whole paragraph and then answer the question or describe what you learned about
7 0
2 years ago
Other questions:
  • Marcus just created a new folder specifically for his buisness records so he would like to move last months business transaction
    13·2 answers
  • Name some of the file extensions for images and provide more information about one or two of them.
    12·1 answer
  • To move one screen to the left press ____.
    9·1 answer
  • X = 0
    15·1 answer
  • Which of the following should you NOT do when using CSS3 properties to create text columns for an article element? a. make the c
    12·2 answers
  • Which is a good guideline to follow when choosing a background for your slides?. . A. Use a different background for each slide.
    8·1 answer
  • Please help it would mean to world to me❤️ (WORD)
    13·1 answer
  • Why are object-oriented languages very popular?
    11·2 answers
  • Which command do you use to save a document with a new name? Choose the answer.
    10·2 answers
  • The internet is controlled by ______
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!