This is really my first time to seek help on computer science class... Do-Not Li
ID: 3637675 • Letter: T
Question
This is really my first time to seek help on computer science class...Do-Not List:
No Global Variables (you can have global constants)
No use of the stdio library (use iostream and fstream)
Instead of the string class, you will be using arrays of characters and the cstring library
Problem You Need to Solve for This Lab:
You have noticed that there is a lot to do this term as we get familiar with C and programming on a larger scale. With a full load of classes, you may have many due dates to meet. Keeping track of everything is important. You have decided to write a program that reads tasks from the user and saves them in a data file to keep track of.
What Your Program Should Do:
Write an interactive text based menu interface (using a loop) that will allow the user to
Enter a task or assignment
Display all of the tasks that are in the file
Find a task by Course
Quit
For each task, you need to keep track of:
Course Name that it is for (e.g., CS162)
Description of the assignment (e.g., Finish Lab 2)
Due date (e.g., 9/26/2009)
Allow the program to keep looping until user wants to quit. When user enters the three items of a task, you need to read them in and write them to the external data file ("tasks.txt"). The file format could look like: (The ';' is used as a delimiter or field seperator.)
CS162;Finish Lab 2;9/26/2009
CS201;Take Quiz 1;9/28/2009
Some Implementation Requirements:
Write at least four functions WITH arguments for this assignment.
Echo your input and ask the user if it is correct (have a confirmation loop again!)
Hint: In this assignment, the description and course name may have multiple words in it. Therefore, you now SHOULD read using the 3 argument version of get.
Watch out. When using the 3 argument version of get you need to make sure to remove the delimiter or newline. Therefore, anytime you read (even a confirmation message), make sure to eat the newline!
Make sure to have a delimiter written between each item in the file
Explanation / Answer
#include #include using namespace std; /* structure to store data */ struct list{ char name[100]; double cost; struct list *next; }; /* This function will add data to the list having fist node pointed by f */ void add(struct list **f,char *n,double p){ struct list *first,*ptr,*ptr1; first = *f; if(first ==NULL) { ptr=*f = new struct list; strcpy(ptr->name,n); ptr->cost = p; ptr->next = NULL; } else { ptr1 = first; while(ptr1 != NULL) { ptr=ptr1; ptr1=ptr1->next; } ptr->next = new struct list; ptr = ptr->next; strcpy(ptr->name,n); ptr->cost = p; ptr->next = NULL; } } /* Display the list data with total cost using setf,setprecision and showpoint */ void display(struct list **f){ struct list *ptr; double amount=0; ptr=*f; coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.