至今还保存着当初学 C语言 时的代码,现在看来已经有点生疏,毕竟好久没玩了。

往事不堪回首啊!

直接贴代码了:

#include <stdio.h>
struct student
{int num;char name[15];float score[3];double avr;
};
struct student stu[50];
struct student input()
{struct student studn;int i,sum=0;printf ("请输入学号:");scanf ("%d",&studn.num);printf ("请输入姓名:");scanf("%s",&studn.name);for(i=0;i<3;i++){printf ("第%d 个成绩:",i+1);scanf ("%f",&studn.score[i]);sum+=studn.score[i];}studn.avr=sum/3.0;return studn;
}
void display(struct student stud[],int count)
{printf ("\n学号\t姓名\t平均成绩\n");for (int i=0;i<count;i++){printf ("%d",stud[i].num);printf ("\t%s",stud[i].name);printf ("\t%7.2f",stud[i].avr);printf ("\n");}
}
void sort (struct student stud[],int count)
{struct student t;for (int i=0;i<count;i++){for (int j=0;j<count-i-1;j++){if ((stud[j].avr)<(stud[j+1].avr)){t=stud[j];stud[j]=stud[j+1];stud[j+1]=t;}}}
}void insert (struct student stud[],int count)
{int i,j;struct student temp;printf ("请输入要插入学员的信息\n");temp = input();for(i=0;i<count;i++){if((stud[i].avr)<(temp.avr))break;}for (j=count;j>=i;j--){stud[j+1]=stud[j];}stud[i]=temp;
}
void display2(struct student stud[],int count)
{printf ("\n学号\t姓名\t平均成绩\n");for (int i=0;i<(count+1);i++){printf ("%d",stud[i].num);printf ("\t%s",stud[i].name);printf ("\t%7.2f",stud[i].avr);printf ("\n");}
}
void dele (struct student stud[],int count )
{int i,j,temp;//struct student temp;printf ("请输入要删除的学员的学号:\n");scanf ("%d",&temp);// temp=input();for (i=0;i<count;i++){if (stud[i].num==temp){for (j=i;j<count;j++){stud[j]=stud[j+1];}}}
}void main()
{int count=0;char ch='Y';while((ch=='y')||(ch=='Y')){stu[count]=input();count++;printf ("是否要继续(y/n):\n");fflush(stdin);scanf ("%c",&ch);}printf ("\n排序前的学员成绩序列如下:");display(stu,count);sort (stu,count);printf ("排序后的学员成绩序列如下:");display (stu,count);insert(stu,count);printf ("插入后的学员成绩序列如下:");display2 (stu,count);dele(stu,count+1);display (stu,count);
}

  

谢谢浏览!

转载于:https://www.cnblogs.com/Music/archive/2012/03/10/c-language-learners-performance-management.html

我的编程生涯的入门语言 - C语言之学员成绩管理相关推荐

  1. 【编程书库】入门+进阶C语言,这几本就够了!

    相信不用我说你也知道,C语言是一种非常流行.简单且灵活的通用编程语言,被广泛应用于各种应用程序中,在TOIBE编程语言榜单中,C语言自从5月份超越Java登上第一后,就稳坐第一的宝座. 今天就和大家分 ...

  2. c语言结构体编辑学生成绩管理,C语言基于结构体的学生信息管理系统实现

    宋福英 摘  要: 中国高校为保证学生信息安全,各分院的学生信息都在一个相对封闭的闭环内共享.中国高校在校生人数逐年递增,给高校的信息管理带来不小压力.C语言兼具高级语言和汇编语言的特点,简洁.紧凑. ...

  3. c语言结构体编辑学生成绩管理,【C语言】结构体的应用以及学生成绩管理系统的设计...

    一.结构体 数组中的各元素是属于同一个类型的.有时需要将不同类型的数据组合成一个整体,以便于引用.如,一个学生的学号.姓名.性别.年龄.成绩.家庭地址等项.这些项都与某一学生相联系.如果分别定义为互相 ...

  4. python和c哪个适合入门-编程入门选什么语言好?C 语言还是Python ?为你解析

    前面我分享过计算机行业已经成了学校选择排名第一,家长和学生都很看好计算机类专业.现在IT行业也越来越火爆,程序员越来越被人看好.面对相比同龄人高薪资的诱惑,人们很难不心动,即使秃头也值得! 那么问题来 ...

  5. 入门C语言模板,C语言入门经典-C语言编程

    C语言入门经典-C语言编程Tag内容描述: 1.第01章C语言编程,C语言是一种功能强大.简洁的计算机语言,通过它可以编写程序,指挥计算机完成指定的任务.我们可以利用C语言创建程序(即一组指令),并让 ...

  6. c语言编程培训ppt,C语言入门经典-C语言编程.ppt

    <C语言入门经典-C语言编程.ppt>由会员分享,可在线阅读,更多相关<C语言入门经典-C语言编程.ppt(27页珍藏版)>请在人人文库网上搜索. 1.第01章 C语言编程,C ...

  7. c语言入门经典doc,C语言入门经典C语言编程.ppt

    C语言入门经典C语言编程.ppt 第01章 C语言编程,C语言是一种功能强大.简洁的计算机语言,通过它可以编写程序,指挥计算机完成指定的任务.我们可以利用C语言创建程序即一组指令,并让计算机依指令行事 ...

  8. 编程入门c语言ppt,C语言入门经典-C语言编程.ppt

    <C语言入门经典-C语言编程.ppt>由会员分享,可在线阅读,更多相关<C语言入门经典-C语言编程.ppt(27页珍藏版)>请在装配图网上搜索. 1.第01章 C语言编程,C语 ...

  9. 编程入门选什么语言好?C 语言还是Python ?为你解析

    前面我分享过计算机行业已经成了学校选择排名第一,家长和学生都很看好计算机类专业.现在IT行业也越来越火爆,程序员越来越被人看好.面对相比同龄人高薪资的诱惑,人们很难不心动,即使秃头也值得! 那么问题来 ...

最新文章

  1. iOS视频流采集概述(AVCaptureSession)
  2. 7天试学计划 | 人工智能核心能力课程招生
  3. Go Reflect
  4. 以不变应万变:因果启发的稳定学习年度研究进展(下篇)
  5. 用群体测试开发成功的应用程序
  6. 使用RegularExpressionValidator限制多行文本框的字数
  7. centos 下载为firefox安装flash插件
  8. 前端学习(3047):vue+element今日头条管理-使用table表格组件
  9. P3938 斐波那契
  10. 《图解HTTP》核心知识总结
  11. python地理位置聚类_python – 用于聚类地理位置数据的DBSCAN
  12. 《白帽子讲web安全》学习笔记 (3)
  13. C++Builder STL 泛型
  14. Kubernetes持久化方案(PV、PVC、StorageClass)
  15. 前端面试有这几篇就够了--HTML篇
  16. 火狐扩展教程_5个Firefox扩展保护您的隐私
  17. 07 巧算指数温度--参考即可不用算
  18. 【tkGo】将Excel里的图片链接替换为图片(Excel嵌入图片)
  19. python的拼音_Python返回汉字的汉语拼音(原创) | 学步园
  20. Excel进度条设置百分比解决

热门文章

  1. imperial college rejection
  2. a good resource gathering system from sustech
  3. 实事求是来讲,比较艰难的环境能够激发人的斗志
  4. learning material at the outer world
  5. 如何才能写好一篇文章?
  6. 关于集体生活和个人生活的思考
  7. 简单易懂棒棒哒的视频传输工具!
  8. WHAT IS ERP
  9. 根据json文件读取json信息
  10. java学习笔记-4 JVM垃圾回收(GC)