Print out a response based on the random number

Assignment Help Basic Computer Science
Reference no: EM131741825

MAGIC 8 BALL: This program will ask the user to enter a yes/no question and it will then print out an appropriate yes or no response. Hint: You will have to read in the question into a string variable, but you don't really need it. Your program will generate a random number from 0 to 7 (depends on how many responses you want to have in your program) and it will print out a response based on the random number.( in c++ programming)

1. promptuser()

a. Does not return a value

b. Does not have arguments

c. This function will prompt the user (print out a message asking for a yes or no question). The function will read in the question into a string variable (even though we don't need it later).

2. getrandom()

a. Returns an integer which is the random number to be used

b. Does not have arguments

c. This function will generate a random number from 0 to 7 (depends on how many responses you have - see below). The function will return the random number back to the main body.

3. Printresponse()

a. Does not return a value

b. It does have 1 argument, the random number. Based on this number the function will print out an appropriate response.

c. Use a switch statement and depending on what the random number is, print out a message. For example, if the random number

i. is 0, print out "No way!".

ii. is 1, print out "Unfortunately ... yes!"

iii. is 2, print out "YASSSS!"

vi. is 3, print out "I wish I could say yes..."

v. is 4, print out "Of course not!"

Reference no: EM131741825

Questions Cloud

Theory contributes to organizational ethics and diversity : Choose an ethical theory and discuss how this theory contributes to organizational ethics and diversity.
Impact on ptsn and cellular systems : What is the current state of VoIP and it's impact on PTSN and cellular systems?
How do organization select the right employee : How do they select the right employee? There are a number of tools and assessments that are used in selecting candidates for any given role.
What would the comparison distribution be : Many communities worldwide are lamenting the effects of so-called big box retailers (e.g., Wal-Mart) on their local economies, particularly on small.
Print out a response based on the random number : You will have to read in the question into a string variable, but you don't really need it. Your program will generate a random number
Documentation is necessary to support accurate coding : Clinical documentation is the foundation of every health record, and high-quality clinical documentation is necessary to support accurate coding.
Define two terms with their definitions and two passages : define two terms with their definitions and two passages, Orpheus Descending & Suddenly Last Summer
Hard rock value system work for automobile assembly line : How do midscale restaurants differ from high-check average restaurants? How would Hard Rock’s value system work for automobile assembly line workers?
Calculate degrees of freedom : Calculate degrees of freedom and identify the critical t value in each of the following circumstances: A two-tailed test based on 8 observations at a p level.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Identifies the cost of computer

identifies the cost of computer components to configure a computer system (including all peripheral devices where needed) for use in one of the following four situations:

  Input devices

Compare how the gestures data is generated and represented for interpretation in each of the following input devices. In your comparison, consider the data formats (radio waves, electrical signal, sound, etc.), device drivers, operating systems suppo..

  Cores on computer systems

Assignment : Cores on Computer Systems:  Differentiate between multiprocessor systems and many-core systems in terms of power efficiency, cost benefit analysis, instructions processing efficiency, and packaging form factors.

  Prepare an annual budget in an excel spreadsheet

Prepare working solutions in Excel that will manage the annual budget

  Write a research paper in relation to a software design

Research paper in relation to a Software Design related topic

  Describe the forest, domain, ou, and trust configuration

Describe the forest, domain, OU, and trust configuration for Bluesky. Include a chart or diagram of the current configuration. Currently Bluesky has a single domain and default OU structure.

  Construct a truth table for the boolean expression

Construct a truth table for the Boolean expressions ABC + A'B'C' ABC + AB'C' + A'B'C' A(BC' + B'C)

  Evaluate the cost of materials

Evaluate the cost of materials

  The marie simulator

Depending on how comfortable you are with using the MARIE simulator after reading

  What is the main advantage of using master pages

What is the main advantage of using master pages. Explain the purpose and advantage of using styles.

  Describe the three fundamental models of distributed systems

Explain the two approaches to packet delivery by the network layer in Distributed Systems. Describe the three fundamental models of Distributed Systems

  Distinguish between caching and buffering

Distinguish between caching and buffering The failure model defines the ways in which failure may occur in order to provide an understanding of the effects of failure. Give one type of failure with a brief description of the failure

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd