I am trying to read from a file that looks like this
when I read from this file I want to store each of these values in a string or int. Then I want to output to files called east and west, in this format:Code:Joseph Stevens Boys 11 20 5 Jamie Stevens Girls 22 18 6 Tony Waters Boys 33 22 7 Sally Smith Girls 44 33 8
Lastname Firstname Teamname Scoring average
Code:tokstring ( ) { FILE * input, * east, * west; char string; char *token; char *first; char *last; char *team; int *number; int *points; int *games; double *average; while ( first || last || team || number || points || games != NULL ) { fgets (string, 80, input ); first = strtok (NULL, " "); last = strtok (NULL, " "); team = strtok (NULL, " "); number = strtok (NULL, " "); points = strtok (NULL, " "); games = strtok (NULL, " "); fprintf (east, "%s\t", last); fprintf (west, "%s\t", last); fprintf (east, "%s\t", first); fprintf (west, "%s\t", first); if ( team == "girls" ); fprintf (east, "%s\t", team); else fprintf (west, "%s\t", team); average = ( points / games ); fprintf (east, "%6.2f\t", average); fprintf (west, "%6.2f\t", average); } }
}[/CODE]
the error messages I get when I compile are
Code:project8.c: In function `tokstring': project8.c:68: `input' undeclared (first use in this function) project8.c:68: (Each undeclared identifier is reported only once project8.c:68: for each function it appears in.) project8.c:68: warning: passing arg 1 of `fgets' makes pointer from integer without a cast project8.c:72: warning: assignment from incompatible pointer type project8.c:73: warning: assignment from incompatible pointer type project8.c:74: warning: assignment from incompatible pointer type project8.c:76: `east' undeclared (first use in this function) project8.c:77: `west' undeclared (first use in this function) project8.c:82: parse error before `else' project8.c:84: invalid operands to binary /



LinkBack URL
About LinkBacks


