1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char *argv[])
{
char name[20];
int ID[4];
int Quiz1, Quiz2, Quiz3, Quiz4;
int Exam;
float Average_score;
FILE* spTable;
int sum;
spTable = fopen("1234.DAT","r");
if (!spTable)
{
printf("Could not open file\a\n");
}
printf("\nName \tID \tQuiz1 \tQuiz2 \tQuiz3 \tQuiz4 \tExam");
while((fscanf(spTable, "%d %d %d %d %d %d", &name, &ID, &Quiz1, &Quiz2, &Quiz3, &Quiz4, &Exam)) != EOF)
printf("\n \%d \%d \%d \%d \%d", name, ID, Quiz1, Quiz2, Quiz3, Quiz4, Exam);
system("PAUSE");
return 0;
}
|