Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
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
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
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].
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
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:(!infile.eof())
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.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
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()?
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
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"?
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.