Question: Provided is a text file schedule.txt. It determines what I am doing at any given time during the day. Your code will read those files,

Provided is a text file schedule.txt. It determines what I am doing at any given time during the day. Your code will read those files, saving into 2 arrays the time and activity. Then a user can (1) put in a time, and the code will find and print the activity or (2) put in an activity, and print the time. Your task is in the following parts.

1) Write your search algorithm in pseudocode or a flowchart.

2) Write the code based on the pseudocode/flowchart.

3) Test the algorithm.

Along with this document, there are 2 files. The first is the daily schedule. The second is a template you can use. Abridge the template as you want. You must use the command line environment to run and test the code.

0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23
Dreaming Sleeping Snoring Nightmaring Stirring Snoozing Alarming Grooming Eating Driving Sitting Teaching Scarfing Whittling Lecturing Grading Napping Commuting Grilling Chilling Maxing Relaxing Snacking Dozing
#include  #include  #include  using namespace std; void printMenu(){ //DO NOT TOUCH THIS PART cout << endl << "---------------- "; cout << "Enter 0 to exit "; cout << "Enter 1 to search by number "; cout << "Enter 2 to search by activity "; } int main(){ //YOU EDIT THIS ifstream infile("Lab2_Schedule.txt"); int choice = 0; int hour[24] = {0}; //Fill both arrays, even though one will just be index values string activity[24] = {"Empty"}; //populate the arrays here do{ printMenu(); } while(choice != 0); }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!