Where are my mistakes and what are they? This code is my fisrt code about linked list. So ı cannot found mistakes easily. I would appreciate if you could help.
void add(Node *&firstLooked)
{
string taskName;
string personName;
string time;
Node *current = new Node;
Node *additive = new Node;
current = firstLooked;
cout << "Please enter the task: ";
getline(cin, taskName);
additive->task = taskName;
cout << "Please enter name of person who does the task: ";
getline(cin, personName);
additive->person = personName;
cout << "Please enter the deadline like this: dd.mm.year : ";
getline(cin, time);
additive->date = time;
This code include lots of error. An output of code:
A: Add Task
S: Search for Task
L: List All Tasks
R: Remove Task
E: Exit
Choose an operation:
A
Please enter the task: Please enter name of person who does the task: John
Please enter the deadline like this: dd.mm.year : 12.03.2014
A: Add Task
S: Search for Task
L: List All Tasks
R: Remove Task
E: Exit
Choose an operation:
A
Please enter the task: Please enter name of person who does the task: William
Please enter the deadline like this: dd.mm.year : 14.02.2014
A: Add Task
S: Search for Task
L: List All Tasks
R: Remove Task
E: Exit
Choose an operation:
L
All tasks are listed below:
Process returned -1073741819 (0xC0000005) execution time : 41.936 s
Press any key to continue.
I've taken a quick look at your code and run it thru a memory checker.
A few comments.
1. You should use the format tags when posting code. I've posted it with indentation so I could read it. But infuture, you should not post unformatted code.
2. You need to go thru the logic one operation at a time, and check the linked list is correct. As you're using Windows, I expect you have easy access to a good debugger.
There's just too much code and too many obvious failures (like call remove with an unrecognized id). You really need to learn how to fix this yourself.
mutexe (866) >> in my complier, there is not a problem during compiling. I wish there was a problem during compiling, so maybe ı can understand what my mistakes are; but there is not a problem during compiling. Thank you.
kbw (6676) >> ı take into account your comments. I hope, i can learn how to fix this myself. Thank you.