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
Software that protects confidentiality by screening outgoing documents to identify and block transmission of sensitive informati
GarryVolchara [31]

Answer:

d. Data Loss Prevention (DLP)

Explanation:

Data Loss Prevention (DLP) -

It refers to the type of strategy , where any sensitive or personal information can not be leaked out in the corporate network , is referred to as data loss prevention .

There are various software products that help to save the data , by controlling the information shared by the users .

The method is important for any business .

Hence , from the given scenario of the question ,

The correct answer is d. Data Loss Prevention (DLP) .

7 0
3 years ago
You were just hired as an IT Specialist for Smalltown School District. Your first assignment is to review a problem area&amp; in
umka21 [38]

Answer:

Explanation:

There are various questions that you can ask in this scenario, such as

What grading policies are being implemented?

How many student grades are being calculated by the program?

What is the requirements for a student to pass?

All of these questions would allow you to get an idea of how extensive the code may be and its complexity. Once you know this you would look at the code revolving around actually looping through the data and doing the necessary calculations. You can then determine how to manipulate the code and make it much more efficient.

You would also need to know how the student data is being saved, which will help determine if it is the best data structure for saving this type of data or if it can be replaced in order to maintain the data secure while increasing the speed of the program. Mainly since this information needs to be continuously used from the data structure.

3 0
3 years ago
A search engine that crawls uses
RoseWind [281]

Answer:

web crawlers or spider software

Explanation:

A search engine that crawls uses the web crawler or the spider software. And it also uses the server side JavaScript based crawlers and programming languages like Python and PHP. The search engine finds the content category through the meta keywords and directs the page to the index. The index contains details of similar types of pages, And each page has one category, and if category is not found which is rarest, a new category is being created.

7 0
3 years ago
Any anime weebs wanna talk
erastova [34]

Answer:

Sowwy, it's not Me!

The Bermuda Triangle, also known as the Devil's Triangle, is a loosely defined region in the western part of the North Atlantic Ocean where a number of aircraft and ships are said to have disappeared under mysterious circumstances. Most reputable sources dismiss the idea that there is any mystery.[1][2][3]

Bermuda Triangle

Devil's Triangle

6 0
2 years ago
Read 2 more answers
An acceptable website design is one that meets
Harman [31]

Answer:

i'd say b

Explanation:

5 0
2 years ago
Read 2 more answers
Other questions:
  • A way to minimize technical problems with your computer
    14·1 answer
  • Operational feasibility, which refers to user acceptance and support, as well as management acceptance and support, is also know
    9·1 answer
  • Hiiiiiiiiiii hiiiiiiiiiiiiiiiiiii
    9·2 answers
  • 2 Manter o autocontrole nos ajuda a evitar muitos problemas na nossa vida pessoal e no ambiente profissional. Em se tratando de
    14·1 answer
  • Write a program named RectangleArea to calculate the area of a rectangle with a length of 15.8 and a width of 7.9. The program s
    10·1 answer
  • While (e &lt; 10):<br> print (c)
    10·1 answer
  • 9.
    15·1 answer
  • WHO HAS TWITCH<br> PLS FOLLOW ME MY TWITCH IS giaplayzgamez I'm uploading Videos Soon.
    11·2 answers
  • Write the line of Python code that calculates and prints the answer to the following arithmetic expressions.
    7·1 answer
  • 1.<br> _g<br> clue: fret; become worried<br> 2.<br> Fret become worried
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!