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
What is the type of person of personal computer which is also called a laptop computer?
gulaghasi [49]

Today personal computer is changed to laptop mode. Personal computer is made of CPU, monitor, keyboard, printer and mouse. All input device and output device connected with wire or without wire.

<u>Explanation:</u>

Personal computers are also called as desktop or workstation. These days all become compatible device which is called as laptop.

Basically all input devices and output device are fixed in laptop so end user can carry the laptop and used anywhere.

Laptop is charged and used, whereas desktop or workstation just fixed in the table and used it.

7 0
4 years ago
A ____ rootkit is one that becomes a part of the system bootstrap process and is loaded every time the system boots. Select one:
Dmitriy789 [7]

Answer: d) Persistent rootkit

Explanation:

Persistent rootkit is the rootkit device that performs the constant function of getting loaded at every moment when the computer system gets started.This function is automatically executed .

  • Other options are incorrect because user-mode rootkit,kernel mode rootkit and memory-orientated rootkit are not devices that gets activated every time the computing system gets booted -up.
  • Thus, the correct option is option(d).
6 0
4 years ago
How would you explain these three security risks (phishing, keylogging, malware) to a family member? What would you say to help
kompoz [17]

Answer:

1. Phishing is a cybercrime in which a target or targets are contacted by email, telephone or text message by someone posing as a legitimate institution to lure individuals into providing sensitive data such as personally identifiable information, banking and credit card details, and passwords.

2. Keyloggers are built for the act of keystroke logging — creating records of everything you type on a computer or mobile keyboard. These are used to quietly monitor your computer activity while you use your devices as normal.

3. Malware is intrusive software that is designed to damage and destroy computers and computer systems.

Explanation:

All of these can be used to steal data & passwords

5 0
3 years ago
(Game Design) Which of the following is a free alternative for working with vector graphics?
stepladder [879]

Adobe Illustrator option D is correct

because vector files or vector graphics are used in adobe illustrator

5 0
3 years ago
Do you think tracking your screen time will reduce your usage? Why or Why not?
dezoksy [38]

Answer:

I dont think it will help much

Explanation:

Well, just tracking it will not necessarily make you stop. I would recommend putting app limits or downtime (if you have a mac). Also make a log. Write down how much time you need for different things, like 1 hour of free time, 5 hours of schoolwork. Also, make a schedule based off the things you put on your log.

I found doing this helped me reduce my time on screen and made me more productive.

6 0
3 years ago
Other questions:
  • Dave has to create animations for a game. Which tool can Dave use?
    9·2 answers
  • You have implemented nap with dhcp enforcement, so you need to ensure you have an updated anti-virus software package, an update
    7·1 answer
  • A network administrator has been tasked with configuring access to the Internet for about 50 computers. The administrator has be
    6·1 answer
  • Could someone give an example or tell me what all of these mean? (For internet source citing)
    10·1 answer
  • The Institute of Electrical and Electronics Engineers (IEEE) is an organization that researches and institutes electrical standa
    15·2 answers
  • What option do you use to view your presentation?
    15·1 answer
  • On tool hackers use to get sensitive information from victims is/are:
    15·2 answers
  • Which view displays the records in columns and rows like excel worksheet​
    11·1 answer
  • What is the dark web and what is the .onion domain
    15·2 answers
  • Gnome ____ are small programs available on the gnome panel that are designed to give you quick access to useful applications.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!