ok and you were correct with your sum of the numbers instead of my count of the numbers
which means ill probably have to change the program
so ill need more variables maybe?
and have a sum somewhere.
Obviously, you will need some variable to hold your sum - and calling it sum would be a good idea, because that gives people some idea of what it's used for. On the other hand, you no longer need a count variable [although it could be useful to CHECK how many numbers you've added together, to see if you believe that your program does the right thing].
youll be happy to know that i got the count program working without a hitch.. i usedfor the while statement. now just to modify that to make it work for the sum of numbers instead of the count of the numbersCode:
That is actually incorrect - infile.eof() will only tell you that you are at the end of file when you have attempted to read PAST the end of file, so you will do one more loop than you exect to do.
hmm it gives me the correct amount of numbers in the file whenever i change the input file for the count program
what would you suggest instead of infile.eof()?
ok yah programing is somewhat new to me so its gonna take me a while to get some of the things your trying to say
so now onto the part with adding the numbers together.... i know i have to use infile >> variable... but how to order it from there confuses me...
So give it your best shot. Have you not written any code before to add things together, that you could use as a "template"?