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

nvm i got the answer
I'm writing an argument research paper on drug abuse can some one help me with starting it please and will mark!!!
You are on a train traveling east at speed of 16 m/s with respect to the ground. Your friend is sitting on another train traveling west at 12 m/s. As you walk t
The theme is usually revealed in the resolution of the story because (5 points) the theme relates to the lesson learned from the conflict the theme shows what t
3.what would be the best place to build an optical telescope? 4.A measure of the amount of light given off by a star is its? 5.the first artificial satellite
Xsquare + 10x + 16 equals 0
What is the main reason for the stratification in the north polar waters?
You are working in the lab looking at slides of bacteria and blood, which container should you dispose of the slides in after you are done? The waste basket Th
What is one million divided by 32???????
is 43 a composite number or a prime number