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
Elden [556K]
3 years ago
11

Write a program that lets the user guess the coin's head or tail. The program randomly generates an integer 0 or 1, which repres

ents the head or the tail. The program prompts the user to enter a guess and reports whether the guess is correct or incorrect. include step by step commentary.
Computers and Technology
1 answer:
svlad2 [7]3 years ago
7 0

Answer:

#include <iostream>

#include <stdlib.h>

#include <time.h>

using namespace std;

int main()

{

   srand (time(NULL));  //initialize random seed

   int guess;

    int number = rand() % 2;  //generate random number 0 or 1

    cout<<"Enter the guess (0 or 1): ";

    cin>>guess;     //store in guess

    if(number == guess){     //check if number equal to guess

       cout<<"Guess is correct."<<endl;   //if true print correct message.

    }else{

        cout<<"Guess is incorrect."<<endl;  //otherwise print correct message.

    }

    return 0;

}

Explanation:

first include the three library iostream for input/output, stdlib,h for using the rand() function and time for using the time() function.

create the main function and initialize the random number generation seed, then generate the random number using the function rand() from 0 to 1.

after that, take input from user and then with the help of conditional statement if else check if random number is equal to guess number or not and print the appropriate message.

You might be interested in
If you are running a server , which of the follow operating system would be best suited ?window 10 or macOS
Travka [436]

Answer:

MacOS. MacOS is always better for developers with the linux-like commands. The powerful shell for hosting servers, downloading programs for the servers, and much more. Windows is easier to use for normal users, but does not have a good shell for running commands. But the best OS to run a server on is Linux. Over 90% of servers are hosted on some linux distribution. Probably most of them are Ubuntu

Please mark me as brainliest.

8 0
3 years ago
Question is on the picture thank you
andreyandreev [35.5K]

I've included the spin and main method. I also included the public class. You can just ignore everything besides the spin method.

8 0
2 years ago
A radio and communications security repairer is responsible for both radio and satellite communication systems.
natita [175]
I'm almost certain the answer is true
3 0
3 years ago
Read 2 more answers
1. True or false: The more pixels per inch in an image, the higher the resolution is. (1 point)
Annette [7]
1. true
2. pixel
3. raster images are built with pixels
4. false
5. image size
6. rollover
7. sharp with clear details
8. 78px
9. 24in
10. scalability
3 0
3 years ago
Which of the following is a technique for storing or copying log events to acentralized logging server?a. Syslogb. Write­once re
Neporo4naja [7]

Answer:A) Syslog

Explanation: Syslog is the log for the messaging in the computing field.It acts as a separator for the different task that is related to messaging. The task usually are storing of message, production of the message through software,analyzing message, reporting it etc.

Other options given in the question such as WORM storage is for the storage technology,UTM is for the management for the threat situation and firewall logging is related with log/tables for firewall.

Thus, the correct option is option (A).

5 0
3 years ago
Other questions:
  • An investigator obtains consent and HIPAA authorization from subjects to review their medical records and HIV status. He plans t
    8·1 answer
  • Difference between change management n asset management
    11·1 answer
  • Limitations of the information systems used by tesco​
    7·1 answer
  • Do you have to make a account of Windows 10?
    12·1 answer
  • 01110101<br> +00100100<br> 00010001
    8·1 answer
  • How is science and technology used in the society​
    11·1 answer
  • Which of the following statements is true regarding a user account? Once a user account has been created, it cannot be completel
    8·1 answer
  • What is the setting an alarm clock output??
    10·1 answer
  • Match the feature to its function.
    7·1 answer
  • Name four successful conversions to an electronic health record system in a medical facility
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!