資源簡介
本程序用于學生成績管理,輸入學生人數,成績,并進行排序
代碼片段和文件信息
/*
時間:2020年3月7日17:02:32
功能:實現學生成績管理
*/
#include
#include
struct?Student
{
int?age;
float?score;
char?name[100];
};
//函數功能:輸入學生信息
void?InputStudent(struct?Student?*pstint?len)
{
int?i;
????for(i=0;i {
printf(“請輸入第%d個學生的信息:\n“i+1);
printf(“age?=?“);
scanf(“%d“&pst[i].age);
printf(“name?=?“);
scanf(“%s“pst[i].name);
printf(“score?=?“);
scanf(“%f“&pst[i].score);
}
}
//函數功能:冒泡算法實現成績升序排列
void?sort(struct?Student?*pstint?len)
{
???int?ij;
???struct?Student?t;
???for(i=0;i {
for(j=0;j {
if(pst[j].score>pst[j+1].score)
{
t?=?p
- 上一篇:編碼及轉碼(libiconv庫)
- 下一篇:C99標準的新特性.pdf
評論
共有 條評論