Alright - this is my conundrum. As a noob to C++ I am only in chapter 9 of my book, having just covered object oriented programs and the exciting world of vectors and arrays. I have an assignment that asks me to run a loop to get and calculate a set of values, validate them against a set standard, and then print them to a file. I can do that.
My problem is that I am supposed to allow infinite entry and the assignment explicitly states that I cannot use an array to store the entered values. Initially I tried incrementing a structure, but apparently you can't do that unless it's an array of structures, which I think violates the assignment guidelines. As far as I know, vectors also require a size declarator, so I run into the problem of allowing the user to enter as many values as they like. So . . . I started looking into appending to a file? I don't really understand it; it's not covered in my book so far, and I haven't been able to get it to work. I'm trying to use a while loop that terminates on value -1 with a nested loop that terminates at EOF - supposedly to allow the user to enter the values, then call a function to validate the entries and make calculations based on them - then write it to a file on each loop iteration. I can post code when I get home if that helps.
My question amounts to - what is the most efficient way for a noob programmer to store data from a loop without resorting to an array?
Edited by yozzie: n/a