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

What is the area of the moon?
Help Please! What was Phillis Wheatley's occasion, genre, and audience?
what is 5 divided by 312 in the long way
what is 1/10 of 90000
Cartels, monopolies, trusts, as well as horizontal and vertical integration all share the goal of _____. a.raising wages b.driving up costs c.increasing profits
Which of these excerpts from Homer’s Iliad contains an epic simile? As wasps, provoked by children in their play, Pour from their mansions by the broad highway,
4.5 , 3.25 , 2 , 0.75 next three terms
Sharon is 54 inches tall. tree in her backyard is five times as tall as she is. the floor of her treehouse is at a height that is twice as tall as she is. What
On June 9, 1983, the lower part of the Variegated Glacier in Alaska was observed to be moving at a rate of 64 m per day. What is this speed in kilometers per ho
what is the unit fraction for 12/84