Write a program that simulates a Magic 8-Ball. Prompt the user for a question, and randomly select a response from a vector. The attached Responses file is available if you want to use it, OR you may create your own response file, OR you can add/modify/remove the responses in the attached file. Continue to prompt for questions until the user wants to exit the program (Pick your own exit condition, but the program must loop until the condition is met!). Additional requirements: Header comments must be present Prototypes must be present if functions are used Hello and goodbye messages must be shown Use vector(s) for implementation Use comments and good style practices HINT: Read the contents of the response file into an a vector. When the user enters a question, generate a random index and display the response from the vector with that index. Make sure to check for the exit condition. To generate the random index, use the following in main() - this should be familiar by now...unsigned seed = time(0); srand(seed); Make sure to include all the necessary header files (cstdlib, ctime, vector, etc.).If you use the provided response file, download the attached text file and place in same location as your program. If you create your own response file, make sure to place it in the same location as your program. SAMPLE RUN:Welcome to the Magic 8-Ball program!Ask yes/no questions and the program will give you clarity about the outcome...Enter EXIT to exit the program.Please ask your question: Will I get a good grade in this class?Without a doubt, yes.Please ask your question: Does the professor know what he's talking about?I'll tell you after my nap.Please ask your question: EXIT Exiting program. Goodbye!   Language is C++ Please make it as simple as possible.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

Write a program that simulates a Magic 8-Ball. Prompt the user for a question, and randomly select a response from a vector. The attached Responses file is available if you want to use it, OR you may create your own response file, OR you can add/modify/remove the responses in the attached file. Continue to prompt for questions until the user wants to exit the program (Pick your own exit condition, but the program must loop until the condition is met!).

Additional requirements:

  • Header comments must be present
  • Prototypes must be present if functions are used
  • Hello and goodbye messages must be shown
  • Use vector(s) for implementation
  • Use comments and good style practices

HINT: Read the contents of the response file into an a vector. When the user enters a question, generate a random index and display the response from the vector with that index. Make sure to check for the exit condition.

To generate the random index, use the following in main() - this should be familiar by now...unsigned seed = time(0);

srand(seed);

Make sure to include all the necessary header files (cstdlib, ctime, vector, etc.).If you use the provided response file, download the attached text file and place in same location as your program.

If you create your own response file, make sure to place it in the same location as your program.

SAMPLE RUN:Welcome to the Magic 8-Ball program!Ask yes/no questions and the program will give you clarity about the outcome...Enter EXIT to exit the program.
Please ask your question: Will I get a good grade in this class?Without a doubt, yes.
Please ask your question: Does the professor know what he's talking about?I'll tell you after my nap.
Please ask your question: EXIT

Exiting program. Goodbye!

 

Language is C++

Please make it as simple as possible.

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 2 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education