Programalama > C++

Etiketler: öss, kagit, okuma

Ort. 0
Puan ver:
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#include<stdio.h>
#include<conio.h>
 
int main()
{ FILE *stud_file;
  FILE *answer_file;
 
answer_file=fopen("c:\\answer.dat","r");
int studnum,aa=0,bb=0,cc=0,dd=0,blank=0,aaa=0,bbb=0,ccc=0,ddd=0,bblank=0,aaaa=0,bbbb=0,cccc=0,dddd=0,bbblank=0;
char name[20];
char sname[20];
char studans[50];
char booktype;
char correctans[50];
int dogru=0,yanlis=0;
float grade;
int maxa=0,maxb=0,maxc=0;
char ahiname[20],ahisname[20],bhiname[20],bhisname[20],chiname[20],chisname[20];
int ahinumber,bhinumber,chinumber;
printf("Student   Student                Correct    Wrong     Total\n");
printf("Number    Name and Last Name     Answer     Answer    Grade\n");
do
{stud_file=fopen("c:\\booklet.dat","r");
 fscanf(answer_file,"%d %s %s %s",&studnum,&studans,&name,&sname);
 
 if(studans[0]=='A')
 { for(int y=0;y<1;y++)
 {fscanf(stud_file,"%s",&correctans);}
 }
 
 else if(studans[0]=='B')
 {
 for(int i=0;i<2;i++)
 {
 fscanf(stud_file,"%s",&correctans);
 }
 }
 else if(studans[0]=='C')
 {
 for(int j=0;j<3;j++)
 {
 fscanf(stud_file,"%s",&correctans);
 }
 }
 
for(int cnt=1;cnt<51;cnt++)
{   if((studans[cnt]=='*')||(correctans[cnt]=='*')){continue;}
    if(studans[cnt]==correctans[cnt])
    {
    dogru++;
    }
    else
    {
    yanlis++;
    }
}
grade=(dogru*2)-(yanlis*0.25);
 
printf("%d\t  %s %s\t\t %d\t\t%d\t%f\n",studnum,name,sname,dogru,yanlis,grade);
 
if(studans[0]=='A')
{
    if(maxa<grade)
    {
        maxa=grade;
    for(int p=0;p<21;p++)
    {
    ahiname[p]=name[p];
    }
    for(int z=0;z<21;z++)
    {
    ahisname[z]=sname[z];
    }
 
    ahinumber=studnum;
     
 
    }
    else {maxa=maxa;}
 
 
 
}
if(studans[0]=='B')
{
    if(maxb<grade)
    {maxb=grade;
    for(int p=0;p<20;p++)
    {
    bhiname[p]=name[p];
    }
        for(int n=0;n<20;n++)
    {
    bhisname[n]=sname[n];
    }
     
    bhinumber=studnum;
 
     
}
 
     
else {maxb=maxb;}
}
if(studans[0]=='C')
{
    if(maxc<grade)
    {maxc=grade;
    for(int p=0;p<21;p++)
    {
    chiname[p]=name[p];
    }
    for(int m=0;m<21;m++)
    {
    chisname[m]=sname[m];
    }
     
    chinumber=studnum;
    }
    else {maxc=maxc;}
}
 
dogru=0;yanlis=0;grade=0.0;
fclose(stud_file);
}while(feof(answer_file)==0);
fclose(answer_file);
fclose(stud_file);
printf("\n\n");
 
printf("%d %s %s Booklet A Got the highest grade in this group \n",ahinumber,ahiname,ahisname);
 
printf("%d %s %s Booklet B Got the highest grade in this group \n",bhinumber,bhiname,bhisname);
 
printf("%d %s %s Booklet C Got the highest grade in this group \n",chinumber,chiname,chisname);
 
 
return(0);
}


Yorumlar                 Yorum Yaz
Bu hazır kod'a ilk yorumu siz yapın!
KATEGORİLER
ASP - 240
ASP.NET - 24
C# - 75
C++ - 174
CGI - 8
DELPHI - 247
FLASH - 49
HTML - 536
PASCAL - 246
PERL - 11
PHP - 160
WML - 9
XML - 2
Copyright © 2002 - 2025 Hazır Kod - Tüm Hakları Saklıdır.
Siteden yararlanırken gizlilik ilkelerini okumanızı tavsiye ederiz.
hazirkod.com bir İSOBİL projesidir.