Write a program that simulates the Oracle of Delphi by displaying a random response to a yes/no question posed by the user. The following file (oracle_responses.txt) contains a set of possible...

1 answer below »

Write a program that simulates the Oracle of Delphi by displaying a random response to a yes/no question posed by the user. The following file (oracle_responses.txt) contains a set of possible responses, one response per line. Your program should ask the user for the path to the file of responses and it should read the responses from the response file and store them into an array. Your program should then prompt the user to ask a question, display one of the responses randomly selected from the array and repeat until the user is ready to quit.




Other Assignment Requirements and Notes




• Your program should be decomposed into functions and optionally files. I recommend that you include tools.h and tools.cpp in your project.




• When creating your array, you should create it with a size of 25.




• When reading the responses from the response file, you must handle the following situations:




• more or less responses/lines in the file than the size of your array.




• When seeding the random number generator, remember that seeding should happen only once near the beginning of your program.




• You may only use concepts and language features presented in class so far (i.e., chapters 1-7 + lecture/demo on separate compilation).




To be more specific the concepts only allowed are as stated below.




( 1. Output,Variables


2. Input, Operations


3. Selection,Bool, Enum, Compound statements


4. Iterations and Files


5. Functions and Separate compilation


6. Arrays )




Program should match the Sample Output shown below.




Enter the name of the response file: ( Respond file should be written here)




Ask your question: Is today Friday?


For sure!




Do you want to ask another question (y/n)? y




Ask your question: Am I a girl?


Without a doubt, no




Do you want to ask another question (y/n)? y




Ask your question: Will I win the lottery?


Reply hazy, try again.




Do you want to ask another question (y/n)? y




Ask your question: Will I win the lottery?


Outlook good.




Do you want to ask another question (y/n)? y




Ask your question: Will I live a long time?


Don't count on it.




Do you want to ask another question (y/n)? n







Answered Same DayMay 10, 2021

Answer To: Write a program that simulates the Oracle of Delphi by displaying a random response to a yes/no...

Rushendra answered on May 11 2021
137 Votes
SOLUTION.PDF

Answer To This Question Is Available To Download

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here