5个学生3门课程成绩的排名器

时隔这么久没更新,心里有点不舒服。今天,我做了一个挺好玩的程序。希望大家能够喜欢。大家多加评论和关注。

#include

using namespace std;

#include

struct STUDENT

{

char Num[9];

char Nam[10];

int Score[3];

int ScoreSum;

double ScoreAve;

};

void Input(STUDENT stu[],int n)

{

for(int i=0;i

{

cout<<"学号:";

cin>>stu[i].Num;

cout<<"姓名:";

cin>>stu[i].Nam;

cout<<"三门课成绩:";

cin>>stu[i].Score[0];

cin>>stu[i].Score[1];

cin>>stu[i].Score[2];

}

}

void Output(STUDENT stu[],int n)

{

cout<<"学号"<

for(int i=0;i

{

cout<

cout<

cout<

cout<

cout<

cout<

}

}

void Cal(STUDENT stu[],int n)

{

for(int i=0;i

{

stu[i].ScoreSum=stu[i].Score[0]+stu[i].Score[1]+stu[i].Score[2];

stu[i].ScoreAve=stu[i].ScoreSum/n;

}

}

void Sort(STUDENT stu[],int n)

{

int i,j;

STUDENT temp;

for(i=1;i

{

for(j=0;j

{

if(stu[j].ScoreSum >stu[j+1].ScoreSum )

{

temp=stu[j];

stu[j]=stu[j+1];

stu[j+1]=temp;

}

}

}

}

int main()

{

STUDENT stu[5];

cout<<"请输入一班学生成绩:"<

Input(stu,5);

cout<

Output(stu,5);

Cal(stu,5);

Sort(stu,5);

Output(stu,5);

}

程序就是以上了。有不懂的问题评论出来,我会一一解答。我有许多漏洞,请私信。感谢

感谢

萌萌哒!

展开阅读全文

页面更新:2024-06-07

标签:成绩   学生   学号   英语   私信   漏洞   语文   姓名   课程   数学   程序   喜欢

1 2 3 4 5

上滑加载更多 ↓
推荐阅读:
友情链接:
更多:

本站资料均由网友自行发布提供,仅用于学习交流。如有版权问题,请与我联系,QQ:4156828  

© CopyRight 2020-2024 All Rights Reserved. Powered By 71396.com 闽ICP备11008920号-4
闽公网安备35020302034903号

Top