Sorry to bother this forum once again but I've got a program to read the input file as records. The problem is all it does is cout Record Number etc but it doesn't grab the data. I'm sure I've made a mistake and am not asking for hand outs, just a point in the right direction.
The books has it has tab so it outputs right. Tried your code but it throws up a bunch of errors I had before.
But by tabs do you mean the white space tab, that's intentional (book teaching me bad habits).
To be honest I don't understand this bit of code ( ( i + 1 ) % 4 == 0 )
No idea what it is suppose to do. Which makes it harder to understand the entire programs and solve errors.
Tried your code but it throws up a bunch of errors I had before.
My code was exactly the same as your code. There is no functional difference.
The only thing I changed was I changed some whitespace so the problem is easier to see.
You are indenting your code in a way which does not reflect what the code is actually doing. I changed the indentation to reflect what the code is actually doing.
Hint: look around line 20 in my code.
To be honest I don't understand this bit of code
( ( i + 1 ) % 4 == 0 )
% gives you the remainder after division. IE: 7 % 4 equals 3 because 7/4 is 1 remainder 3.
In that code... i is a loop counter that increments each loop iteration. So %4 will give you 0 every 4 iterations. So every 4th iteration that condition will be true... and on the other 3 iterations it will be false.
I see which makes sense since the records.txt is seperates by 4 tabs. I see your code and still cannot figure out my issue. Says in the book "Reading up to a \t tab for the first the items and up to \n newline for the fourth item on each line.
EDIT: Oh I added the \t on line 20 for the tab. Still isn't reading the reading and outputting the data, god I hate being a noob lol.