Well essentially you were given a skeleton program. At the top you open the file using fopen() which expects you to pass a filename to the program using the command prompt...
c:\blahblah.exe c:\myinputfile.txt
From there it loops through the file reading each line (using fscanf) until it reaches the end of the file (file EOF aka END OF FILE). As it reads each line, it evaluates it for special command words like insert, find or delete. If it encounters these words, it then reads in the value following the word and this is where you are then to write functions which carry out the function.
For instance, you read in the file and encounter the command "find" which then you read in the number following the command. So the line in the file would look like... FIND 12
This program already reads the 12 in for you, but then you are expected to write a function called "find()" and pass that 12 to your function which would then search an array or something else and return something like the position it was found in (it doesn't cover that part unfortunately).
So where you see it say "call find here" you might do this...
CODE
else if(strcmp(string,"Find") == 0)
{
//FIND
fscanf(fileObject, "%d", &assocvalue);
// Call find here
int position = myCustomFindFunction(assocvalue);
if (position > 0) {
cout << "Found the number " << assocvalue << " at position: " << position << endl;
}
}
You are to write these custom functions for each of the commands in the else if statement that says "write such and such here".
Hope that makes sense to you. Good luck!
"At DIC we be code deciphering if else statement loving code ninjas!"