-
Notifications
You must be signed in to change notification settings - Fork 3
/
Test.c
77 lines (52 loc) · 1.29 KB
/
Test.c
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#include<stdio.h>
#include<math.h>
void main(){
char i,I,N[20],Q1,Q2,Q3,Q4;
FILE *fp1,*fp2,*fp3;
fp1 = fopen("Data.txt","w+");
//fprintf(fp1,"Name\tID\tQuiz 1(Out of25)\tQuiz 2(Out of25)\tQuiz 3(Out of25)\tQuiz 4(Out of25)\n");
for(i=1;i<=5;i++){
printf("\tName? ");
scanf("%s",&N);
printf("\n");
printf("\tID? ");
scanf("%d",&I);
printf("\n");
printf("\tQuiz 1 Marks? ");
scanf("%d",&Q1);
printf("\n");
printf("\tQuiz 2 Marks? ");
scanf("%d",&Q2);
printf("\n");
printf("\tQuiz 3 Marks? ");
scanf("%d",&Q3);
printf("\n");
printf("\tQuiz 4 Marks? ");
scanf("%d",&Q4);
printf("\n");
fprintf(fp1,"%s\t%d\t%d\t%d\t%d\t%d\t",N,I,Q1,Q2,Q3,Q4);
}
fclose(fp1);
int id[5],a[5],b[5],c[5],d[5],e[5],f[5],j,k,l;
char name[5][10];
fp2 = fopen("Data.txt","r");
//fscanf(fp2,"\n");
for(j=0;j<5;j++){
fscanf(fp2,"%s\t%d\t%d\t%d\t%d\t%d\t",name[j],id[j],a[j],b[j],c[j],d[j]);
e[j]=a[j]+b[j]+c[j]+d[j];
}
printf("\nList for More than 70%:\n");
for(k=0;k<5;k++){
if(e[k]>70){
printf("%s\t%d\n",name[k],id[k]);
}
}
fclose(fp2);
printf("\n======================= Q1 ======================\n");
/*
fp3 = fopen("Data.txt","r");
for(l=0;l<5;l++){
}
f[l]=
fclose(fp3);*/
}