Question
Asked Feb 5, 2020
8 views
Drawa structured flowchart , C++,  write pseudocode that describes the process of guessing a number between 1 and 100. After each guess, the player is told that the guess is too high or too low. The process continues until the player guesses the correct number. Pick a number and have a fellow student try to guess it following your instructions.
check_circle

Expert Answer

Step 1:Flowchart

A flowchart of guessing a number between “1” and “100” is as follows,

Computer Engineering homework question answer, step 1, image 1

Step 2:Pseudocode

A pseudocode of guessing a number between “1” and “100” is as follows,

START

num1<-Generate random number between “1” and “100”

Get num2

while num2!=num1

          if num2>num1 then

              print “Your guess is too high”

          else

              print “Your guess is too low”

          endif

          Get num2

     endwhile

     print “You are correct”

STOP

Step 3:Program

A C++ program for the given criteria is as follows,

File name: "main.cpp"

#include <iostream>

#include<cstdlib>

using namespace std;

int main()

{

    int num1,num2;

    num1= (rand() % 100) + 1;

    cout<<"Guess a number"<<endl;

    cin>>num2;

    while(num2!=num1)

    {

        if(num2>num1)

        {

        cout<<"Your guess is too high"<<endl;

        cout<<"Guess another numer"<<endl;

        cin>>num2;

        }

        else

        {

        cout<<"Your guess is too low"<<endl;

        cout<<"Guess another numer"<<endl;

        cin>>num2;

    &n...

Want to see the full answer?

See Solution

Check out a sample Q&A here.

Want to see this answer and more?

Solutions are written by subject experts who are available 24/7. Questions are typically answered within 1 hour.*

See Solution
*Response times may vary by subject and question.
Tagged in

Engineering

Computer Engineering

Related Computer Engineering Q&A

Find answers to questions asked by student like you
Show more Q&A
add
question_answer

Q: How would I solve this problem in python language Grades a) Write a program that reads in the names ...

A: Program Instructions:Use the open() function to read from the file.Save the result o spilt() functio...

question_answer

Q: prove algebraically(w'+x+y')(w+x'+y)(w+y'+z)(w+y'+z)=x'y'+wx+xyz+w'yzthe question is from fundamenta...

A: LHS = (w'+x+y')(w+x'+y)(w+y'+z)(w+y'+z)Applying idempotent law (A+A) = AWe get by dropping the last ...

question_answer

Q: Write a query to display the patron ID, book number, and days kept for each checkout. “Days Kept” is...

A: NOTE: - AS THE SCHEMA WASN’T PROVIDED, THE NEW SCHEMA IS ASSUMED WITH THREE RECORDS.Select is used t...

question_answer

Q: what is the difference between technology and frame work when it comes to computer engineering?

A: Definition:TECHNOLOGYTechnology, in general refers to the scientific knowledge that is applicable fo...

question_answer

Q: What is the output of the following code? !doctype html> Find the output ax3 + b2 - c abc ...

A: HTML math tag is used to insert MathML elements inside a webpage. With in &lt;msup&gt; tag those cha...

question_answer

Q: 1. What is the output of the following code? public class Loopy {public static void main(String[] ar...

A: 1.Explanation for the given java code:In the class "Loopy", variable "x" is declared and initialized...

question_answer

Q: Multiple industries are considering the conversion of existing vehicles to autonomously operated veh...

A: Solution:Multiple industries are considering the conversion of existing vehicles to autonomously ope...

question_answer

Q: Describe attack on an authentication scheme based on web cookies??

A: Attack on an authentication scheme based on web cookies: There are some attacks which are responsibl...

question_answer

Q: Hi, how can I find out what kind of thread models (one-one, one-many or many many) does my operating...

A: Thread model used by operating system:Whenever there is a need for the operating system to multiplex...