c语言问题,急~~~高手帮忙。。。
#include<time.h> #include<stdio.h>
#include<conio.h>
#include <stdlib.h>
#define MAX 50
void input();
void sort();
void display();
void insert();
void del();
void average();
int now_no=0;
struct student
{
int no;
char name[20];
char sex[4];
float score1;
float score2;
float score3;
float sort;
float ave;
float sum;
};
struct student stu[MAX],*p;
main()
{ char a;
char as;
start:printf("\n\n\n************************************************************************************************************************************************************\n\n");
printf("\t\t\t************************************************huan ying shi yong2007ji ke xue shen cheng ji xi tong****************************************************\n\n");
printf("\n\n\n****************************************************************************************************************************************************************\n\n");
printf("----------------qing shu ru mi ma:--------------\n");
scanf("%s,&a");
if(a==a)
{do{
printf("\n\t\t\t\t1.lu ru chen xue sheng cheng ji\n\t\t\t\t2.xian shi xue sheng cheng ji\n\t\t\t\t3.cheng ji pai xu\n\t\t\t\t4.tian jiaxue sheng cheng ji\n\t\t\t\t5.shan chu xue sheng cheng ji\n\t\t\t\t6.tui chu\n");
printf("\t\t\t\txuan ze gong neng xuan xiang:");
as=getch();
switch(as)
{
case '1':
system("cls");
input();
break;
case '2':
system("cls");
display();
break;
case '3':
system("cls");
sort();
break;
case '4':
system("cls");
insert();
break;
case '5':
system("cls");
del();
break;
case '6':
system("exit");
exit(0);
default:
system("cls");
goto start;
}
}while(1);
}
void input()
{
int i=0;
char ch;
do
{
printf("\t\t\t\t1.lu r xue sheng chen ji\nshu ru di%d ge tong xue de cheng ji\n",i+1);
printf("\nshu ru xue sheng de cheng ji:");
scanf("%d",&stu[i].no);
fflush(stdin);
printf("\nshu ru xue sheng de xing ming:");
fflush(stdin);
gets(stu[i].name);
printf("\nshu ru xue sheng de xing bie:");
fflush(stdin);
gets(stu[i].sex);
printf("\nshu ru xue sheng de cheng ji:");
fflush(stdin);
scanf("%f",&stu[i].score1);
printf("\nshu ru xue sheng de cheng ji:");
fflush(stdin);
scanf("%f",&stu[i].score2);
printf("\nshu ru xue sheng de cheng ji:");
fflush(stdin);
scanf("%f",&stu[i].score3);
printf("\n\n");
i++;
now_no=i;
printf("%d",now_no);
printf("shi fou ji xu shu ru?(Y/N)");
ch=getch();
system("cls");
}
while(ch!='n');
system("cls");
}
void sort()
{
struct student temp;
int i,j;
for(i=1;i<now_no;i++)
{
for(j=1;j<=now_no-i;j++)
{
if(stu[j-1].ave<stu[j].ave)
{temp=stu[j];
stu[j]=stu[j-1];
stu[j-1]=temp;
}}}
}
void display()
{
int i;
char as;
float ave;
do
{
printf("\t\tban jixue sheng cheng ji\n");
printf("\tbian hao\txing ming\txing bie\tcheng ji\tcheng ji\tcheng ji\tping jun zhi\n");
for(i=0;i<now_no;i++)
{
stu[i].sum=stu[i].score1+stu[i].score2+stu[i].score3;
stu[i].ave=stu[i].sum/3;
printf("\t%d\t%s\t%s\t%.2f\t%.2f\t%.2f\t%.2f\n",stu[i].no,stu[i].name,stu[i].sex,stu[i].score1,stu[i].score2,stu[i].score3,stu[i].ave);
}
printf("\t\tan ren yi jian fan hui.");
as=getch();
goto exit;
}
while(as!='n');
exit: system("cls");
}
void insert()
{
char ch;
do
{
printf("\n\t\tshu ru xin de ban ji xin xi\n");
printf("\nshu ru xue sheng de bian hao:");
scanf("%d",&stu[now_no].no);
fflush(stdin);
printf("\nshu ruxue sheng de xing ming:");
fflush(stdin);
gets(stu[now_no].name);
printf("\nshu r xue sheng de xing bie:");
fflush(stdin);
gets(stu[now_no].sex);
printf("\nshu ru xue sheng de cheng ji:");
fflush(stdin);
scanf("%f",&stu[now_no].score1);
printf("\nshu ru xue sheng de cheng ji:");
fflush(stdin);
scanf("%f",&stu[now_no].score2);
printf("\nshu ru xue sheng de cheng ji:");
fflush(stdin);
scanf("%f",&stu[now_no].score3);
printf("\n\n");
now_no=now_no+1;
sort();
printf("shi fou jixu shu ru?(Y/N)");
ch=getch();
system("cls");
}
while(ch!='n');
}
void del()
{
int inum,i,j;
printf("shu ruyao shan chu de xue sheng bian hao:");
fflush(stdin);
scanf("%d",&inum);
for(i=0;i<now_no;i++)
{
if(stu[i].no==inum)
{
for(j=i;j<now_no;j++)
{
stu[i]=stu[i+1];
}
now_no=now_no-1;
}
break;
}
system("cls");
printf("\n\n\n************************************************************xie xie shi yong!**********************************************\n\n");
}else exit(0)}
帮忙看看错哪了?急,,,谢谢!