Using C coding, Please use data from a text file "data.txt" with the corresponding values 3 2 0 -5 6 9 3 -7 4 40 2 16.78 -4 4 3 4 5 6 2 -1 4 13 5 15.98 Column 1 is a value, column 2 is b value, column 3 is c value, column 4 is d value. You need to create a script that pulls each line from this text file, one row at a time and inputs them into an equation within the script. Each row will need to be put into the equation a + b + c - d and the result should be displayed in a new text file called "result.txt" To clarify, the code will read the data.txt file and place each row into the above equation, displaying the resulting value for each row into result.txt The format for the way result.txt should be formatted is: 1. the first column will indicate Positive/Negative values where 1 is a positive solution and 0 is a negative solution 2. the second column will display the result of the equation Please give each column a name in the text file. Use printf code in your script. Show screenshot of solutions please.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Using C coding,

Please use data from a text file "data.txt" with the corresponding values

3 2 0 -5

6 9 3 -7

4 40 2 16.78

-4 4 3 4

5 6 2 -1

4 13 5 15.98

Column 1 is a value, column 2 is b value, column 3 is c value, column 4 is d value.

You need to create a script that pulls each line from this text file, one row at a time and inputs them into an equation within the script.

Each row will need to be put into the equation a + b + c - d and the result should be displayed in a new text file called "result.txt"

To clarify, the code will read the data.txt file and place each row into the above equation, displaying the resulting value for each row into result.txt

The format for the way result.txt should be formatted is:

1. the first column will indicate Positive/Negative values where 1 is a positive solution and 0 is a negative solution

2. the second column will display the result of the equation

Please give each column a name in the text file.

Use printf code in your script.

Show screenshot of solutions please.

Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY