Q BgQuestion:

      
Novice
Karma Points: 35
Respect (98%):
posted by  vpeezy on 11/7/2009 6:43:14 AM  |  status: Closed  |  Earned Karma: 35

data files

Course Textbook Chapter Problem Needs by
N/A N/A N/A N/A 11/7/2009 at 12:00:00 PM
Question Details:
Heres an algorithm that reads all the numbers from a file, displays them and then closes the file:
Declare InputFile numberList
Declare Integer i
Open numberList "number_list.dat"
Display "Here are the numbers:"
While NOT eof (numberList)
   Read NumberList i
   Display i
End While
Close myName
Heres my question...From this algorithm that i wrote, i have to modify it so that it adds all of the numbers read from the file and displays their total
I have done it a few times but what i did just seems too simple.  some help would be great
Thanks
Bonus Point Alert! Earn +15 additional karma points for helping this platinum member.

AAnswers:

Answer Question Ask for clarification
Oracle
Karma Points: 31,807
posted by rapunzel on 11/7/2009 8:37:30 AM  |  status: Live
Asker's Rating: Lifesaver   
Response Details:
please rate - thanks
Don't doubt yourself it is so simple
I've added it in red

Declare InputFile numberList
Declare Integer i
Declare Integer sum
Open numberList "number_list.dat"
Display "Here are the numbers:"
Set sum to 0
While NOT eof (numberList)
   Read NumberList i
   Add i to sum
   Display i
End While
Display sum
Close myName


Note to all members 1. Please 1 question per post 2. Show respect to your fellow members by rating all answers. 3. When rating remember that the first answer is not necessarily the best answer. 4. When answering questions, explain what you are doing, so that the asker will learn, don't just give a meaningless number. 5. Your answers should be your work. Don't copy from another member, this is Karma abuse and possible disciplinary actions against you. and GOOD LUCK to you all!!
Answer Question Ask for clarificarion

Join Cramster's Community

Cramster.com brings together students, educators and subject enthusiasts in an online study community. With around-the-clock expert help and a community of over 100,000 knowledgeable members, you can find the help you need, whenever you need it. Join for free today » How Cramster is different from tutoring »