/* #包含" stdio.h "
int I;
void prt()
{
for(I = 5;我& lt8;i++) printf("%c ",' * ");
printf(" \ t ");
}
主()
{
for(I = 5;我& lt=8;i++)PRT();
}
*/
# include & lttime.h & gt
# include & ltstdio.h & gt
# include & ltconio.h & gt
# include & ltstdlib.h & gt
#定義最大50
void輸入();
void sort();
void顯示();
void insert();
void del();
void平均值();
int now _ no = 0;
結構學生
{
int號;
char name[20];
char sex[4];
float score 1;
浮動分數2;
浮動分數3;
浮點排序;
浮動大街;
浮動總和;
};
struct學生stu[MAX],* p;
主()
{
char as
start:printf(" \ t \ t \ tw歡迎使用學生成績管理系統\ n \ n ");
做{
Printf ("\n \ t \ t \ t1。輸入學生信息\ n \ t \ t \ t2。顯示學生信息\ n \ t \ t \ t3。分級信息\ n \ t \ t \。
Printf ("\ t \ t \ t \ tSelect函數選項:");
as = getch();
開關(組件)
{
案例“1”:
系統(“cls”);
input();
打破;
案例“2”:
系統(“cls”);
顯示();
打破;
案例“3”:
系統(“cls”);
sort();
打破;
案例“4”:
系統(“cls”);
insert();
打破;
案例“5”:
系統(“cls”);
del();
打破;
案例“6”:
系統(“退出”);
退出(0);
默認值:
系統(“cls”);
轉到開始;
}
} while(1);
}
無效輸入()
{
int I = 0;
char ch
做
{
Printf ("\ t \ t \ t1。輸入學生信息\n輸入%d名學生的信息\ n ",I+1);
printf(" \ n輸入學號:");
scanf("%d ",& amp斯圖[我]。否);
fflush(stdin);
printf(" \ n輸入學生姓名:");
fflush(stdin);
獲取(stu[i]。姓名);
printf(" \ n輸入學生性別:");
fflush(stdin);
獲取(stu[i]。性);
printf(" \ n輸入學生成績:");
fflush(stdin);
scanf("%f ",& ampstu[I]. score 1);
printf(" \ n輸入學生成績:");
fflush(stdin);
scanf("%f ",& ampstu[I]. score 2);
printf(" \ n輸入學生成績:");
fflush(stdin);
scanf("%f ",& ampstu[I]. score 3);
printf(" \ n \ n ");
i++;
now _ no = I;
printf("%d ",now _ no);
Printf("要繼續打字嗎?(Y/N)");
ch = getch();
系統(“cls”);
}
而(ch!= ' n ');
系統(“cls”);
}
void排序()
{
結構學生溫度;
int i,j;
for(I = 1;我& lt現在_沒有;i++)
{
for(j = 1;j & lt= now _ no-I;j++)
{
if(stu[j-1]。ave & lt斯圖[j]。ave)
{ temp = stu[j];& ltbr/>;stu[j]= stu[j-1];& ltbr/>;stu[j-1]= temp;& ltbr/>;}}}
}
空顯示()
{
int I;
char as
浮動大街;
做
{
printf(" \ t \ t類別信息列表\ n ");
printf(" \ t沒有。\ tName \ t gender \ tachievent \ tachievent \ t average \ n ");
for(I = 0;我& lt現在_沒有;i++)
{
斯圖[我]。sum = stu[I]. score 1+stu[I]. score 2+stu[I]. score 3;
斯圖[我]。ave=stu[i]。sum/3;
printf(" \ t % d \ t % s \ t % s \ t % . 2f \ t % . 2f \ t % . 2f \ t % . 2f \ n ",stu[i]。不,斯圖[我]。姓名,斯圖[我]。性,斯圖[我].分數1,斯圖[我].分數2,斯圖[我].分數3,斯圖[我].ave);
}
printf(" \ t \ t按任意鍵返回主菜單。);
as = getch();
轉到退出;
}
而(作為!= ' n ');
exit:system(" cls ");
}
空心嵌件()
{
char ch
做
{
printf(" \ n \ t \ t輸入新插入的學生團隊的信息\ n ");
printf(" \ n輸入學號:");
scanf("%d ",& amp斯圖【現在_沒有】。否);
fflush(stdin);
printf(" \ n輸入學生姓名:");
fflush(stdin);
獲取(stu[now_no]。姓名);
printf(" \ n輸入學生性別:");
fflush(stdin);
獲取(stu[now_no]。性);
printf(" \ n輸入學生成績:");
fflush(stdin);
scanf("%f ",& ampstu[now _ no]. score 1);
printf(" \ n輸入學生成績:");
fflush(stdin);
scanf("%f ",& ampstu[now _ no]. score 2);
printf(" \ n輸入學生成績:");
fflush(stdin);
scanf("%f ",& ampstu[now _ no]. score 3);
printf(" \ n \ n ");
現在_否=現在_否+1;
sort();
Printf("要繼續打字嗎?(Y/N)");
ch = getch();
系統(“cls”);
}
而(ch!= ' n ');
}
void del()
{
int inum,I,j;
Printf("輸入要刪除的學生編號:");
fflush(stdin);
scanf("%d ",& ampinum);
for(I = 0;我& lt現在_沒有;i++)
{
如果(斯圖[我]。no==inum)
{
for(j = I;j & lt現在_沒有;j++)
{
stu[I]= stu[I+1];
}
現在_否=現在_否-1;
}
打破;
}
系統(“cls”);
}