C语言 下列代码有什么错啊为什么结果总是输不出结果呢,该如何解决

C语言 下列代码有什么错啊,为什么结果总是输不出结果呢
#include<stdio.h>
struct student 
{
char number[10];
char name[10];
int math;
int english;
int C_prog;
};
int main(){
int i=0,j=0,k=0,h=0;
int count=2;
int Sumofmath,Sumofenglish,SumofC_prog; 
char math[2];
char english[2];
  char C_prog[2];
  float averageOfMath,averageOfEnglish,averageOfC_prog;
FILE *fp;
struct student person[2];
  Sumofmath=0;
  Sumofenglish=0;
  SumofC_prog=0; 
  if((fp=fopen("data.in","wr"))==NULL)
{
printf("Can't open the file:data.in\n");
}
for(i=0;i<count;i++){
fscanf(stdin,"%s %s %d %d %d",person[i].number,person[i].name,&person[i].math,&person[i].english,&person[i].C_prog);
//以空格区分;
fprintf(fp,"%s\n%s\n%d\n%d\n%d\n",person[i].number,person[i].name,person[i].math,person[i].english,person[i].C_prog);
}
while(!feof(fp)){
fgets(person[i++].number,10,fp);
fgets(person[i++].name,30,fp);
fgets(math,2,fp);

for(h=0;h<2;h++){
person[i++].math=((int)(math[0]))*10+(int)(math[1]);
}
fgets(english,2,fp);
for(k=0;k<2;k++){
person[i++].english=((int)(english[0]))*10+(int)(english[1]);
}
fgets(C_prog,2,fp);
for(j=0;j<2;j++){
person[i++].C_prog=(int)(C_prog[0])*10+(int)(C_prog[1]);
}
}
fclose(fp);  
  for (i=0;i<count;i++)
  {
  Sumofmath+=person[i].math;
  Sumofenglish+=person[i].english;
  SumofC_prog+=person[i].C_prog;
  }
  averageOfMath=(float)(Sumofmath/2);
  averageOfEnglish=(float)(Sumofenglish/2);
  averageOfC_prog=(float)(SumofC_prog/2);
 printf("Math: %.1f\n",averageOfMath);
 printf("English: %.1f\n",averageOfEnglish);
 printf("C_prog: %.1f\n",averageOfC_prog);  
}

 


------解决方案--------------------
C/C++ code

#include<stdio.h>
struct student  
{
char number[10];
char name[10];
int math;
int english;
int C_prog;
};
int main(){
int i=0,j=0,k=0,h=0;
int count=2;
float Sumofmath,Sumofenglish,SumofC_prog;  //改成float
char math[2];
char english[2];
  char C_prog[2];
  float averageOfMath,averageOfEnglish,averageOfC_prog;
FILE *fp;
struct student person[2];
  Sumofmath=0;
  Sumofenglish=0;
  SumofC_prog=0;  
  if((fp=fopen("data.in","wr"))==NULL)
{
printf("Can't open the file:data.in\n");
}
for(i=0;i<count;i++){
fscanf(stdin,"%s %s %d %d %d",person[i].number,person[i].name,&person[i].math,&person[i].english,&person[i].C_prog);
//以空格区分;
fprintf(fp,"%s\n%s\n%d\n%d\n%d\n",person[i].number,person[i].name,person[i].math,person[i].english,person[i].C_prog);
}

fseek(fp, 0, SEEK_SET);//定位到文件开头
i=0;//重置i
while(i<count){//使用i计数判断
fgets(person[i].number,12,fp);
fgets(person[i].name,12,fp);
fgets(math,4,fp);
person[i].math=(math[0]-'0')*10+math[1]-'0';//你那种算法不对
//for(h=0;h<2;h++){
//person[i++].math=((int)(math[0]))*10+(int)(math[1]);
//}
fgets(english,4,fp);
person[i].english=(english[0]-'0')*10+english[1]-'0';
/*for(k=0;k<2;k++){
person[i++].english=((int)(english[0]))*10+(int)(english[1]);
}*/
fgets(C_prog,2,fp);
person[i].C_prog=(C_prog[0]-'0')*10+C_prog[1]-'0';
/*for(j=0;j<2;j++){
person[i++].C_prog=(int)(C_prog[0])*10+(int)(C_prog[1]);
}*/
i++;//计数增加
}
fclose(fp);       
  for (i=0;i<count;i++)
  {
  Sumofmath+=person[i].math;
  Sumofenglish+=person[i].english;
  SumofC_prog+=person[i].C_prog;
  }
  averageOfMath=Sumofmath/2;(float)(Sumofmath/2);//Sumofmath是int时先取整了,会丢失精度。
  averageOfEnglish=Sumofenglish/2;//(float)(Sumofenglish/2);
  averageOfC_prog=SumofC_prog/2;//(float)(SumofC_prog/2);
 printf("Math: %.1f\n",averageOfMath);
 printf("English: %.1f\n",averageOfEnglish);
 printf("C_prog: %.1f\n",averageOfC_prog);   
}