file processing help!

Hi, okay I'm suppose to write a program that takes a text file(inputFile.txt) with a set format then the compiler will take the data and display it in a different format.

The original format is:
Name: John Milton
Major: EE
GPA: 3.98
Name: Karl Lewis
Major: CS
GPA: 3.6
Name: Homer Simpson
Major: CE
GPA: 4.0

and its suppose to look like this:
Name: Major: GPA:
John Milton EE 3.98
Karl Lewis CS 3.6
Homer Simpson CE 4.0


void main()
FILE *fp;
int c;
fp = fopen( "C:\inputFile.txt", "r" );
if(c == EOF)
printf("file does not exist.");
while(c != EOF)
c = getc(fp);
fclose( fp );
I got this so far but I dont know how to format into a different way. Any help on what to do next?
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!