AlprabaGr6aig0osp AlprabaGr6aig0osp
  • 16-01-2017
  • Computers and Technology
contestada

Write a program that generates a random number between 1 and 100 and ask the user to guess what the number is. if the user's guess is higher than the random , number, the

Respuesta :

kaevras
kaevras kaevras
  • 16-01-2017
You didn't specify a language, so here it is in C++.


#include <iostream>
#include <ctime>

int main()
{
    srand(time(NULL));

    int random, guess;

    random = rand() % 100 + 1;
    std::cout << "Random number generated!\nGuess the number: ";

    std::cin >> guess;

    if (guess == random)
        std::cout << "Yes!";
    else
        std::cout << "No!";

    return 0;
}
Answer Link

Otras preguntas

Through what process does a spermatid become a functioning spermatozoan?
True or false? Opposite angles of a parallelogram are equal.
How does creating an idea inventory help you start a research paper? It helps you figure out what you already know and what you need to research about your topi
Complete the equation that is related to the given equation. t – 1.8 = –2.3 t = –2.3 +
2x + 3y - 2 + 3x + 6y + 7 =?
What was the first military setback for hitlers force?
was america decision to purchase louisiana wrise?was the decision constitutional
The first bus stop on a bus route is 4 miles from school. How many yards is the first bus stop from school?
How does the harmattan contribute to desertification in the Sahel? Choose all answers that are correct. A. It blows rain clouds away. B. It erodes soil. C. It s
Home state of William McKinley