This is what i have so far and I don't know if its right and i don't know how to finish it.
Can someone please show how this is done.
Suppose we have a data file that has 5 columns in each row. Write a C program that reads such an input file and prints out col1, col4, and the sum of col1 and col4 into output.txt for the rows whose col1 is less than 5 and col4 is greater than or equal to col5.
For instance, your program should process the following input.txt and generate the corresponding output.txt as follows: Please Click Link:
http://i86.photobucket.com/albums/k1...netic86/C1.jpg
If you can't see it let me know.
Code:
#include <stdio.h>
main ()
{
int data file, col1, col 2, col3, col4, col5, output file
file * infp , * outfp ;
infp = fopen("Columns Input.txt"); /*Input of File .txt*/
outfp = fopen("Columns Output.txt"); /*Output of File .txt*/
for (i=1; i<=9; i++)
Fscanf (infp, "%d %d &col1,&col4);
Output file = ( col1 + col4);
fprint (outfp,"%d%d\n", data file, output file);
if (col1 < 5)
?????
???
???
if (col4>=col5)
??
??
???
??