C++ (Write an interactive text based menu interface (using a loop)

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)

Some Implementation Requirements:

Write at least four functions WITH arguments for this assignment.
Use struct named Task to model task
Use array of structs to model the collection of tasks.
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 – like a newline. This will be important when you read the information back from the file.

This is my code so far...Please tell me what I am doing wrong!?!


#include <iostream>

int main()
{
char cname[25],desc[20];
FILE *fp,*fp1;
int dt,ch;
std::cout<<"STORING THE COURSE TASK DETAILS;";
std::cout<<ENTER THE COURSE NAME,DESCRIPTION AND DUE DATE

std::cout<<"ENTER 0 TO QUIT;";
if(ch==0)
{
exit;
}
else
std::cin>>cname>>desc>>dt;
fp=fopen("tasks.txt","w");
std::cout<<fp<<cname<<desc<<dt;
fclose(fp);
fp1=fopen("tasks.txt","r");
std::cin>>cname>>desc>>dt;
std::cout<<cname<<desc<<dt;
fclose(fp1);
}
Last edited on
read the requirements more carefully.

requirements wrote:
Therefore, you now SHOULD read using the 3 argument version of get.
See this

http://www.cplusplus.com/reference/istream/istream/get/

for the "the 3 argument version of get".


Neither fcout nor fcin exists. Read this

http://www.cplusplus.com/reference/fstream/fstream/?kw=fstream

for the according stream class.

Note this:
requirements wrote:
Make sure to have a delimiter written between each item in the file – like a newline.
Topic archived. No new replies allowed.