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.
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.
Step by step
Solved in 3 steps with 2 images