CAPE Computer Science Unit 1 · 2014 · Paper 2 · Question 5(d)
A nonprofit organization is asking for donations for a worthy cause. They hope to raise $100,000. All donations are stored in a file called 'donations.txt'. The first line of the file gives the amount the organization hopes to raise. Each line thereafter contains the amount of each donation. The last line of data in the file contains -1 only.
Write a C program that determines and outputs to a file, "funds.txt", the total funds raised and how many donations were made. (You may not use arrays in your solution.)
The mark scheme is shown once you've answered.
Practise this question