Question: Purpose: Create an application, SimpleFileIO that reads floating point data from a file, Numbers.txt, and display the sum of all the floating point values, calculates
Purpose: Create an application, SimpleFileIO that reads floating point data from a file, Numbers.txt, and display the sum of all the floating point values, calculates the square root of the value and writes the value (1 digit precision) and the square root (3 digits of precision) to a another file, Table.txt, in a tabular format. The primary logic is as follows.
Initialize sum
Open inputFile
Test for inputFile open error
Open outputFile
Test for outputFile open error
Output Heading to outputFile
While (Read number and NOT EOF)
Add number to sum
Output number & square root to outputFile
End While
Display sum
Close inputFile
Close outputFile
Upload to the Canvas Lab 7 Submission area.
Output File Content Example
-------------------------------------------------------------------------------
Number Square Root
====== ===========
1.0 1.000
4.0 2.000
56.0 7.483
989.0 31.448
7.0 2.646
7823.0 88.448
Notes:
* Files should be located in the project directory (generally same location as .cpp)
* To Output (Right Justification)
Number Title field width is 6
Square Root Title field width is 17
Number value field width is 6 (maximum size for digits that will be displayed)
Square Root value - field width is 13
Code to be done in C++
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
