找了个50名教师的工资,扣除的程序,结果运行怎么不行?请教大虾们!
#include "stdio.h" struct subtract { float water; float electri; float housing; }; struct teach { char name[20]; 为什么不是 char name[50]; char depart[30]; char depart[50]l; 因为是50名教师的20与30是是少点?? float salary; float bonus; struct subtract wage; }t[50]; main() { int i; char name[20]; printf("Input data:"); for(i=0;i<50;i++) ( 为什么不是for(i=1;i<50;i++) ,我个人认为i=1;i〈50;才是输入50个,i=0,不就是51个了吗?) { scanf("%s",t[i].name); scanf("%s",t[i].depart); scanf("%f",&t[i].salary); scanf("%f",&t[i].bonus); scanf("%f",&t[i].wage.water); scanf("%f",&t[i].wage.electri); scanf("%f",&t[i].wage.housing); } printf("Input name:"); scanf("%s",name); for(i=0;i<50;i++); if(strcmp(t[i].name,name)==0) { printf("name=%s,department=%s\n",t[i].name,t[i].depart); printf("salary=%f,bonus=%f\n",t[i].salary,t[i].bonus); printf("water=%f,electricity=%f,housing=%f",t[i].wage.water,t[i].wage.electri,t[i].wage.housing); } }