초기화 한번더 질문드릴께요 ㅜ
YourWay
질문 제목 : 구조체에서 초기화질문 내용 :
#includestdio.h
#includestring.h
struct mode
{
float k,e,m,total,ptotal,ltotal;
char name[10];
};
void sort(struct mode a[10])
{
int i,j;
struct mode temp, temp2[10];
for(i=0;i9;i++){
for(j=0;j9;j++){
if(a[j].ltotala[j+1].ltotal);
{temp.ltotal = a[j].ltotal;
a[j].ltotal = a[j+1].ltotal;
a[j+1].ltotal = temp.ltotal;
strcpy(temp2-name,a[j].name);
strcpy(a[j].name,a[j+1].name);
strcpy(a[j+1].name,temp2-name);
}
}
}
for(i=0;i10;i++)
{
printf(%s의 점수는 %f입니다\n,a[i].name,a[i].ltotal);
}
}
void main(void)
{
int i=0;
struct mode stu[10];
for(i=0;i10;i++)
{
fflush(stdin);
printf(%d.,i+1); gets(stu[i].name);
printf(국어 : ); scanf(%f,&stu[i].k);
printf(영어 : ); scanf(%f,&stu[i].e);
printf(수학 : ); scanf(%f,&stu[i].m);
stu[i].total = stu[i].k+stu[i].e+stu[i].m;
if((stu[i].k=60)&&(stu[i].e=60)&&(stu[i].m=60))
{stu[i].ptotal=stu[i].total;}
if(stu[i].ptotal=250)
{stu[i].ltotal=stu[i].ptotal;}
}
sort(stu);
}
저 구조체를 초기화 해야지 뒤에 값이 나올듯한데
계속 막히네요 ㅜ 아까부터 수다님이 계속 답해주셧는데
뭔가 자꾸 틀어지네요
어떻게 고쳐야지 값이 나올지 좀 알려주세요