Write a program to do the following: - 1) Read the file Mydata.txt which includes unlimited number of lines, each line consists of three integer numbers. 2) Evaluate the expected arithmetic expression in each line so that the first number is the result of the arithmetic expression by selecting the appropriate arithmetic operator. 3) Display the result of expressions of all lines into a new text file Result.txt Input mydata.txt Expected Output Result.txt 30 5 6 5*6= 30 15 7 8 7+8 = 15 297 9-7-2 125 5 3 5^3 = 125 39 3 9/3=3 826 2+6-8 24 6 4 6*4-24

C++ for Engineers and Scientists
4th Edition
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Bronson, Gary J.
Chapter8: I/o Streams And Data Files
Section8.4: File Streams As Function Arguments
Problem 3E
icon
Related questions
Question
Write a program to do the following: -
1) Read the file Mydata.txt which includes unlimited number of lines, each line consists of
three integer numbers.
2) Evaluate the expected arithmetic expression in each line so that the first number is the
result of the arithmetic expression by selecting the appropriate arithmetic operator.
3) Display the result of expressions of all lines into a new text file Result.txt
Input
mydata.txt
Expected Output
Result.txt
5* 6 = 30
30 5 6
15 7 8
7+8- 15
29 7
9-7-2
5^ 3 - 125
9/3 = 3
2+ 6 -8
125 5 3
39 3
826
24 6 4
6*4- 24
Transcribed Image Text:Write a program to do the following: - 1) Read the file Mydata.txt which includes unlimited number of lines, each line consists of three integer numbers. 2) Evaluate the expected arithmetic expression in each line so that the first number is the result of the arithmetic expression by selecting the appropriate arithmetic operator. 3) Display the result of expressions of all lines into a new text file Result.txt Input mydata.txt Expected Output Result.txt 5* 6 = 30 30 5 6 15 7 8 7+8- 15 29 7 9-7-2 5^ 3 - 125 9/3 = 3 2+ 6 -8 125 5 3 39 3 826 24 6 4 6*4- 24
Expert Solution
steps

Step by step

Solved in 2 steps with 3 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT