Question: C++ Using a text editor create a file called numbers.txt containing data in the exact format below: 23 45 60 12 90 33 10 78

C++

Using a text editor create a file called numbers.txt containing data in the exact format below:

23 45 60

12 90 33

10 78 30

Write a program that will:

Read the entire contents of numbers.txt and write the sum of the integers contained each line to the screen and also to a binary output file called numbers.bin.

For example, the above input file would result in the following screen output.

128 135 118

Close the output file numbers.bin and re-open it for input. Read each sum from the binary file and write it to the screen.

Visually verify that both set of sums match.

Assume you do not know how many lines there are in numbers.txt (in other words you MUST use a while not end-of-file loop) but you may assume there are 3 integers on each line.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!