What I want this part of my code to do is take a data file (Agent_List) with data in the form of
1 Bond James 007 72 99
2 Bourne Jason 9 70 92
3 Grapefruit Bill 3 60 140
and then fill in my integer n and their respective struct objects with the data.
I've tried to be as specific and fair as possible in my question.. please offer some insight if you can.
-This is part of a homework assignment, but only a small piece of it and I have refrained from getting help thus far but I really don't understand what's wrong with my code.
note that the extractor operator (>>) ignores while space so it puts the info into the variable until it hits a white space or a new line. for example
file:
helloworld
file >> mystring1 >> mystring2;
now we output this std::cout << mystring1 << "\n second string is "<< mystring2;
output is
helloword second string is
but if we add white space
file:
hello world
and now output the strings
hello second string is world
with this information you can now assume that there is no need to worry about an endl when taking information. also remember that if you do not change the value of n the array will rewrite over the information already in the place n.