math in file

You will be given a *.txt file, similar to OpeInFile.txt in Doc. Sharing. The file has only one calculation per line. Notice that number of lines in the file is not known. You need to write your program to read each line and write the question and answer into another line.
There are six main math operations: plus, minus, times, divided by, Min, Max. However plus, minus, times, and divided by can be expressed with signs also.
For instance, the input file has only these lines:

12 + 56
9 divided by -3
45 minus 15
Min of 2 and 1
Max of 3 and 5
34 plus 33

Your output file will be

12 + 56 is 68
9 divided by -3 is -3
45 minus 15 is 30
Min of 2 and 1 is 1
Max of 3 and 5 is 5
34 plus 33 is 67
Last edited on
Looks like you got homework to do, goodluck :)
Topic archived. No new replies allowed.