radomes.openskiesproject.org
AlprabaGr6aig0osp AlprabaGr6aig0osp
  • 16-01-2017
  • Computers and Technology
Answered

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

Verified Answer :

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!
Guess the number: ";

    std::cin >> guess;

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

    return 0;
}

Answer Link

Related Questions

2B Each time Mrs Pavlov goes through the Kroger store checkout line her 3year old daughter Ivona screams and begs for candy Mrs Pavlov almost never gives in to
what word best describes the concept of crisis
i really need help and fast Describe and correct the error in finding the solution to 8p gt 7 8p gt7 8p8 78 p 78
Given two areas with equal sunlight and available water Area I has a high amount of atmospheric carbon dioxide while Area II has a low amount of atmospheric car
How many grams of a stock solution that is 870 percent H2SO4 by mass would be needed to make 200 grams of a 355 percent by mass solution
Most are crops like corn goldenrod or clover hydrophytes mesophytes xerophytes
What is the place if 6 in 3476
In the sentence Mary caught a frog the common noun serves as
what is the value of 6n2
Imagine that you plan to write a procedural document What question shoulyou ask yourself to ensure that you address your audience correctlyOA Do I know anyone w