程序四
来源:互联网 发布:快镜头慢镜头回放软件 编辑:程序博客网 时间:2024/04/26 22:20
#include<stdio.h>
#define N 3
#define M 3
struct student
{
long num;
char name[20];
int score[M];
int avg;
char grade;
}stud[N];
void ipt(struct student *p)
{
int i;
clrscr();
printf("Please input the information:/n/n");
for(i=0;i<N;i++,p++)
{
printf("The %d studnet number:/n",i+1);
scanf("%ld",&p->num);
getchar();
printf("The %d studnet name:/n",i+1);
gets(p->name);
printf("The %d studnet score:/n",i+1);
scanf("%d%d%d",&p->score[0],&p->score[1],&p->score[2]);
p->avg=(p->score[0]+p->score[1]+p->score[2])/3;
printf("/n");
}
}
void check(struct student *head,int AVG)
{
struct student *p=head;
int i=0;
for(i=0;i<N;i++)
if(p->avg>(AVG+10)) p->grade='A';
else if((p->avg)>AVG) p->grade='B';
else p->grade='C';
}
void print(struct student *p)
{
int i;
printf("The result is:/n");
for(i=0;i<N;i++,p++)
printf("The %d studnet number:%ld name:%s score:%3.1d,%3.1d,%3.1d,avg:%3.1d,Grade:%c/n",i+1,p->num,p->name,p->score[0],p->score[1],p->score[2],p->avg,p->grade);
}
void main()
{
int i,j,AVG,sum=0;
struct student temp;
clrscr();
ipt(stud);
for(i=0;i<N-1;i++)
for(j=i+1;j<N;j++)
if(stud[i].avg>stud[j].avg)
{temp=stud[i];stud[i]=stud[j];stud[j]=temp;}
for(i=0;i<N;i++)
sum+=stud[i].avg;
AVG=sum/N;
check(stud,AVG);
print(stud);
}
- 程序四
- 程序四
- 四类程序
- VSTO程序基本知识(四)
- theano程序(四)
- 四轴程序理解
- Win32程序(四)
- Java程序日志四
- 四类程序分析
- 四、程序的移植
- 走进程序,又远离程序(四)
- 宇宙存在四类程序
- 行政区划程序的设计(四)
- Java程序性能之四
- 用GDB调试程序(四)
- 四步创建并行程序
- 小寒也会写程序(四)
- 四数最大程序报告
- System Volume Information 拒绝访问
- 程序一
- 程序二
- 程序三
- 当前Java软件开发中几种认识误区
- 程序四
- 程序五
- 程序六
- 使用Visual Studio .NET编写纯C程序的提示
- 祝贺一下
- 一件很恶心的事
- C#排序
- BW---HOW to basis Lo Extraction for SAP-BW
- 让getElementsByName适应IE和firefox