
please wait
|
|
|
|
|
|
|
|
#include "stdafx.h" #include "math.h" #include "string.h" int scores typedef struct { int totalpoints; int totalplayed; int goalscored; int goaldiff; char teamname[20]; } teams *team[20] int main(void) { teams[20]; int i; for (i=0;i<20;i++){ teamname[i].totalpoints= 0; teamname[i].totalplayed= 0; teamname[i].goalscored= 0; teamname[i].goaldiff= 0; for9int j=0;j<20;j++){ teams[i].teamname[j]=' '; } } /*reading the input1a file containing team names*/ FILE *File_Input1a = fopen("C:\\Users\\Kamal\\Desktop\\Assignmennt\\input1a.dat", "r"); while (fscanf(File_input1a, "%s" ,teams[i].name)!=EOF ) {printf("%s \n",teams[i].name); i++; } fclose(File_Input1a); return(0); } /*reading scores from second file*/ int scores FILE *File_Input1b = fopen("C:\\Users\\Kamal\\Desktop\\Assignmennt\\input1b.dat", "r"); int i=0; char team 1, team 2; int score1, score2; printf("Name\tPoints\tplayed\tgoals scored\tgoals against\n") while (fcanf(File_input1b,%s %i %s %i",&team1 &score1 &team2 &score2)!=Eof) { for(team=0;team<20;team++) |