15.2k views
5 votes
Write a fortune program that reads two numbers from a file (input.txt) and writes the sum of those numbers into another file (output .txt ). the output should be in fixed point notation with 2 decimal places

input: 27.7381 56.148
output.txt 77.89

User Nnseva
by
7.9k points

1 Answer

5 votes

Final answer:

The student needs to write a program to read two numbers from a text file, calculate their sum, and output the result in a specific format to another file.

Step-by-step explanation:

The student is asking for help in writing a fortune program that performs a simple arithmetic operation of adding two numbers read from a file named input.txt. After calculating the sum, the program needs to write the result, formatted to two decimal places, into another file called output.txt. The solution involves programming knowledge, specifically file I/O (Input/Output) operations and string formatting in a given programming language.

User Ashkulz
by
7.3k points