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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started