C#学生管理系统公开源代码:

整个项目所有的方法名如下图:

项目核心逻辑图如下:

**1 首先,键立实体类

  private int _id;private string _name;private string _sex;private int _age;private int _score;public int Id{get{return _id;}set{_id = value;}}public string Name{get{return _name;}set{_name = value;}}public string Sex{get{return _sex;}set{_sex = value;}}public int Age{get{return _age;}set{_age = value;}}public int Score{get{return _score;}set{_score = value;}}public Entity(int id, string name, string sex, int age, int score){this._id = id;this._name = name;this._sex = sex;this._age = age;this._score = score;}public Entity(){}public override String ToString(){return "\t\t\t\t\t\t学号:" + Id + "\t姓名:" + Name + "\t性别:" + Sex + "\t年龄" + Age + "\t分数:" + Score;}

**2工具类 **`

 List<Entity> ls = new List<Entity>();private Studao sd = new Studao();Entity e = new Entity();#region  //遍历五条数据public void Init(){for (int i = 0; i < 5; i++){Entity e = new Entity();e.Id = i;e.Name = "学生" + i;if (i % 2 == 0){e.Sex = "男";}else{e.Sex = "女";}e.Age = i;if ((60 + i) > 100){e.Score = 100;}else{e.Score = 80 + i;}ls.Add(e);}foreach (Entity item in ls){Console.WriteLine(item.ToString());}showMain();} #endregion#region //主菜单public void showMain(){Console.WriteLine();Console.WriteLine("\t\t\t\t**********                                                                 **********");            Console.WriteLine("\t\t\t\t                             欢迎使用学生管理系统                                    ");Console.WriteLine("\t\t\t\t**********                                                                 **********");Console.ForegroundColor = ConsoleColor.Red;Console.WriteLine("\t\t\t\t1.查看学员信息   2.增加学员信息   3.修改学员信息   4.删除学员信息   5.退出学生管理系统");Console.ForegroundColor = ConsoleColor.White;Console.WriteLine();Console.WriteLine("键盘输入你的选项:");int i = int.Parse(Console.ReadLine());switch (i){case 1:FindStudent();break;case 2:AddStudent();break;case 3:EditStudent();break;case 4:RemoveStudent();break;case 5:Exit();break;default:break;}Console.ReadKey();}#endregion#region //查看学员信息public void FindStudent(){Console.WriteLine();Console.WriteLine("\t\t\t\t**********                                                                 **********");Console.ForegroundColor = ConsoleColor.Red;Console.WriteLine("\t\t\t\t        1.查看单个学员信息        2.查看所有学员信息          3.返回上级菜单");Console.ForegroundColor = ConsoleColor.White;Console.WriteLine("\t\t\t\t**********                                                                 **********");Console.WriteLine();Console.WriteLine("键盘输入你的选项:");try{int i1 = int.Parse(Console.ReadLine());switch (i1){case 1://查看单个FindSingleStudent();break;case 2://查看所有FindStudentAll();break;case 3: //返回上级菜单showMain();break;default:Console.WriteLine("超出选择范围,请重新输入!!!");FindStudent();break;}}catch (Exception e){Console.WriteLine(e.Message);FindStudent();throw;}}#endregion#region //查看单个学员信息public void FindSingleStudent(){Console.WriteLine();Console.WriteLine("\t\t\t\t**********                                                                 **********");Console.ForegroundColor = ConsoleColor.Red;Console.WriteLine("\t\t\t\t       1.根据学号查看   2.查看最高分学员   3.查看最低分学员   4.返回上级菜单");Console.ForegroundColor = ConsoleColor.White;Console.WriteLine("\t\t\t\t**********                                                                 **********");try{int i2 = int.Parse(Console.ReadLine());switch (i2){case 1://根据学号查看sd.findEntityByID(ls);FindSingleStudent();break;case 2://查看最高分sd.FindMaxScoreStudent(ls);FindSingleStudent();break;case 3://查看最低分sd.FindMinScoreStudent(ls);FindSingleStudent();break;case 4://返回上级菜单FindStudent();break;default:Console.WriteLine("超出选择范围,请重新输入!!!");FindSingleStudent();break;}}catch (Exception e){Console.WriteLine(e.Message);FindSingleStudent();throw;}}#endregion#region //查看所有学员信息public void FindStudentAll(){Console.WriteLine();Console.WriteLine("\t\t\t\t**********                                                                 **********");Console.ForegroundColor = ConsoleColor.Red;Console.WriteLine("\t\t\t\t1.根据年龄排序   2.根据分数排序   3.根据学号排序   4.查看总分与平均分   5.返回上级菜单");Console.ForegroundColor = ConsoleColor.White;Console.WriteLine("\t\t\t\t**********                                                                 **********");try{int i3 = int.Parse(Console.ReadLine());switch (i3){case 1://根据年龄排序sd.FindStudentOrderAge(ls);FindStudentAll();break;case 2://根据分数排序sd.FindStudentOrderScore(ls);FindStudentAll();break;case 3://根据学号排序sd.FindStudentOrderNo(ls);FindStudentAll();break;case 4://查看总分与平均分sd.FindStudentAvgScoreAndSumScore(ls);FindStudentAll();break;case 5://返回上级菜单FindSingleStudent();break;default:Console.WriteLine("超出选择范围,请重新输入!!!");FindStudentAll();break;}}catch (Exception e){Console.WriteLine(e.Message);FindStudentAll();throw;}}#endregion#region //增加学员信息 public void AddStudent(){Console.WriteLine();Console.WriteLine("\t\t\t\t**********                                                                 **********");Console.ForegroundColor = ConsoleColor.Red;Console.WriteLine("\t\t\t\t                     1.录入学员信息   2.返回上级菜单");Console.ForegroundColor = ConsoleColor.White;Console.WriteLine("\t\t\t\t**********                                                                 **********");try{int i4 = int.Parse(Console.ReadLine());switch (i4){case 1://录入学员信息Console.WriteLine("请输入你要增加的学号:");int id = int.Parse(Console.ReadLine());e.Id = id;Console.WriteLine("请输入你要增加的姓名:");string name = Console.ReadLine();e.Name = name;Console.WriteLine("请输入你要增加的性别:");string sex = Console.ReadLine();e.Sex = sex;Console.WriteLine("请输入你要增加的年龄:");int age = int.Parse(Console.ReadLine());e.Age = age;Console.WriteLine("请输入你要增加的分数:");int score = int.Parse(Console.ReadLine());e.Score = score;Console.WriteLine();Console.WriteLine("信息已成功录入!");Console.WriteLine();ls.Add(e);sd.add(e, ls);//   Console.WriteLine("123");AddStudent();break;case 2://返回上级菜单showMain();break;default:Console.WriteLine("超出选择范围,请重新输入!");AddStudent();break;}}catch (Exception e){Console.WriteLine(e.Message);AddStudent();throw;}}#endregion#region //修改学员信息public void EditStudent(){Console.WriteLine();Console.WriteLine("\t\t\t\t**********                                                                 **********");Console.ForegroundColor = ConsoleColor.Red;Console.WriteLine("\t\t\t\t                       1.输入要修改的学号   2.返回上级菜单 ");Console.ForegroundColor = ConsoleColor.White;Console.WriteLine("\t\t\t\t**********                                                                 **********");try{int i5 = int.Parse(Console.ReadLine());switch (i5){case 1://输入要修改的学号Console.WriteLine("请输入要修改学生的学号:");int id = int.Parse(Console.ReadLine());//Console.WriteLine("请输入修改后学生的学号:");//int id1 = int.Parse(Console.ReadLine());Console.WriteLine("请输入修改后学生的姓名:");string name = Console.ReadLine();Console.WriteLine("请输入修改后学生的性别:");string sex = Console.ReadLine();Console.WriteLine("请输入修改后学生的年龄:");int age = int.Parse(Console.ReadLine());Console.WriteLine("请输入修改后学生的分数:");int score = int.Parse(Console.ReadLine());//删除了id1sd.EditStudentByID(id, name, sex, age, score, ls);EditStudent();break;case 2://返回上级菜单showMain();break;default:Console.WriteLine("超出选择范围,请重新输入!!!");EditStudent();break;}}catch (Exception e){Console.WriteLine(e.Message);EditStudent();throw;}}#endregion#region //删除学员信息public void RemoveStudent(){Console.WriteLine();Console.WriteLine("\t\t\t\t**********                                                                 **********");Console.ForegroundColor = ConsoleColor.Red;Console.WriteLine("\t\t\t\t                       1.输入要删除的学号   2.返回上级菜单");Console.ForegroundColor = ConsoleColor.White;Console.WriteLine("\t\t\t\t**********                                                                 **********");try{int i6 = int.Parse(Console.ReadLine());switch (i6){case 1://输入要删除的学号Console.WriteLine("请输入要删除的学号:");int it = int.Parse(Console.ReadLine());sd.RemoveStudent(it, ls);RemoveStudent();break;case 2://返回showMain();break;default:Console.WriteLine("超出选择范围,请重新输入!");RemoveStudent();break;}}catch (Exception e){Console.WriteLine(e.Message);RemoveStudent();throw;}}#endregion#region   //退出学生管理系统public void Exit(){Console.WriteLine();Console.ForegroundColor = ConsoleColor.Red;Console.WriteLine("\t\t\t\t**********                                                                 **********");Console.WriteLine("\t\t\t\t------—————————————感谢使用此产品!————————---------------------");Console.WriteLine("\t\t\t\t**********                                                                 **********");Console.ForegroundColor = ConsoleColor.Red;}#endregion

程序类(program)

 Manage bd = new Manage();//初始化五条数据bd.Init();

dao类写增删改查的

 //快速连续产生相同随机数的解决方案Random r = new Random();#region  //根据ID查询单个学生public void findEntityByID(List<Entity> ls){Console.WriteLine("请输入学号:");int id = int.Parse(Console.ReadLine());foreach (Entity s in ls){if (s.Id == id){Console.WriteLine("学生信息:" + ls[id].ToString());break;}}}#endregion#region  //查看最高分public void FindMaxScoreStudent(List<Entity> ls){double max = 0;max = ls[0].Score;for (int i = 0; i < ls.Count; i++){if (max <= ls[i].Score){max = ls[i].Score;}}for (int i = 0; i < ls.Count; i++){if (ls[i] != null){if (ls[i].Score == max){Console.WriteLine("最高分数是:" + ls[i].ToString());}}}}#endregion#region //查看最低分public void FindMinScoreStudent(List<Entity> ls){double min = 0;min = ls[0].Score;for (int i = 0; i < ls.Count; i++){if (min > ls[i].Score){min = ls[i].Score;}}for (int i = 0; i < ls.Count; i++){if (ls[i].Score == min){Console.WriteLine("最低分数是:" + ls[i].ToString());}}}#endregion     #region  //根据年龄排序public void FindStudentOrderAge(List<Entity> ls){ls = ls.OrderByDescending(x => x.Age).ToList();//ToList()会新开辟一个内存空间foreach (Entity item in ls){Console.WriteLine(item);}}#endregion#region //根据分数排序public void FindStudentOrderScore(List<Entity> ls){ls = ls.OrderByDescending(x => x.Score).ToList();foreach (Entity item in ls){Console.WriteLine(item);}}#endregion#region //根据学号排序public void FindStudentOrderNo(List<Entity> ls) {ls = ls.OrderByDescending(x => x.Id).ToList();foreach (Entity item in ls){Console.WriteLine(item);}}#endregion#region //总分和平均分public void FindStudentAvgScoreAndSumScore(List<Entity> ls){int count = 0;double sum = 0;for (int i = 0; i < ls.Count; i++){if (ls[i] == null){break;}else if (ls[i] != null){sum += ls[i].Score;count++;}}double avg = sum / count;Console.WriteLine("总分:" + sum);Console.WriteLine("平均分:" + avg);}#endregion#region //增加学员信息        public void add(Entity et, List<Entity> ls) {for (int i = 0; i <ls.Count; i++){if (ls[i]!=null) {ls[i] = et;break;}}foreach (Entity item in ls){Console.WriteLine(item.ToString());}}#endregion#region //修改学员的信息//删除了int idpublic void EditStudentByID(int sId,  string name, string sex, int age, int score, List<Entity> ls){bool falg = false;for (int i = 0; i < ls.Count; i++){if (ls[i] != null){if (ls[i].Id == sId){falg = false;ls[i].Name = name;ls[i].Sex = sex;ls[i].Age = age;ls[i].Score = score;break;}else{falg = true;}}}if (falg){Console.WriteLine("系统无法修改此学号!");}foreach (Entity item in ls){Console.WriteLine();Console.WriteLine("修改后的为:" + item.ToString());}}#endregion#region //删除public void RemoveStudent(int sid, List<Entity> ls){for (int i = 0; i < ls.Count; i++){if (ls[i] == null){continue;}if (ls[i] != null){if (ls[i].Id == sid){ls[i] = ls[i + 1];ls[i + 1] = null;Console.WriteLine();Console.WriteLine("成功删除!");Console.WriteLine();}}}foreach (Entity item in ls){if (item != null){//参考资料在QQ群:683782676Console.WriteLine(item.ToString());}} }#endregion

C#学生管理系统源代码相关推荐

  1. c语言实现学生管理系统,C语言学生管理系统源代码

    <C语言学生管理系统源代码>由会员分享,可在线阅读,更多相关<C语言学生管理系统源代码(12页珍藏版)>请在人人文库网上搜索. 1.C语言学生成绩管理系统源代码,保证能用#in ...

  2. java学生信息管理系统排序_JAVA学生管理系统源代码(最新整理)

    <JAVA学生管理系统源代码(最新整理)>由会员分享,可在线阅读,更多相关<JAVA学生管理系统源代码(最新整理)(10页珍藏版)>请在人人文库网上搜索. 1.JAVA 学生管 ...

  3. c语言编程学生管理系统的代码,C语言学生管理系统源代码.doc

    C语言学生成绩管理系统源代码,保证能用-- #include "malloc.h" #include "stdio.h" #include "stdl ...

  4. C语言-学生管理系统源代码

    一.学生管理系统算法分析(增删改查) 1.插入学生信息(需要具备数据结构基础) 建立头结点.建立新结点函数.建立新结点并插入数据 void InsertStudent() {//插入函数int x;s ...

  5. 中南林业科技大学Java实验报告十二:数据库系统设计 - 从0到1搭建java可视化学生管理系统源代码

    文章目录 实验12 数据库系统设计 12.1 实验目的 12.2 实验内容 12.2.1 设计一个数据库Student,包含成绩表Score,其中属性包含学号,姓名,专业,班级,平均成绩.字段名和类型 ...

  6. 数据结构课程实验——学生管理系统——源代码

    源代码 screen类(用来与用户交互) import java.util.*;class screen {void maindan(){student1 pg1=new student1();pg1 ...

  7. 运用HashMap和ArrayList打造一个简单的带文件的控制台学生管理系统(附上类及类方法的思维导图+控制台运行界面截图+源代码)

    文章目录: 一.本文由来 二.适合人群 三.类及类方法思维导图 四.控制台运行界面截图 五.项目源代码链接 六.后记 七.再回首 一.本文由来 今天是2020年1月23日.因为在2019年上半学期Ja ...

  8. 学生学籍管理系统html代码,学生学籍管理系统源代码.doc

    学生学籍管理系统源代码 源代码: 连接数据库的代码: package cn.system.manage.tools; import java.sql.Connection; import java.s ...

  9. C语言学生成绩管理系统源代码

    分享:C语言学生成绩管理系统设计 <C语言程序设计>实训报告 点击查看 ----> C语言学生成绩管理系统(课程设计报告书) 扫描下方公众号,发送 成绩系统 4个字,获取下载源码. ...

  10. java计算机毕业设计学生就业创业管理系统源代码+系统+数据库+lw文档

    java计算机毕业设计学生就业创业管理系统源代码+系统+数据库+lw文档 java计算机毕业设计学生就业创业管理系统源代码+系统+数据库+lw文档 本源码技术栈: 项目架构:B/S架构 开发语言:Ja ...

最新文章

  1. 特斯拉撞了警车:Autopilot全程开启,连撞两车还没自动停下
  2. 日常运维管理技巧十六(iftop网卡流量监控工具)(转载)
  3. [leetcode]26.删除有序数组中的重复项
  4. Angular页面发生更新时,更新如何从view层传递到model层
  5. Feign的构建过程及自定义扩展功能
  6. java.lang.NoSuchFieldError: No instance field
  7. CVPR2020|无需3D运动数据训练,最新SOTA人体姿势估计方法
  8. phpStudy配置站点 解决You don't have permission to access / on this server
  9. 【iOS-cocos2d-X 游戏开发之一】在Mac下结合Xcode搭建Cocos2d-X开发环境!
  10. VMware ESXi6.0注入8060阵列卡驱动过程记录
  11. bjui—关闭dialog以及当前标签
  12. 数学建模(十)博弈论
  13. 银行加息有什么影响(央行加息,对股市和房价有何影响?)
  14. 头脑风暴问题:玻璃水果盘的用法
  15. 最新最全的Android开源项目集合(转)
  16. matlab regress 非线性,MATLAB用regress作多元非线性回归
  17. 树梅派应用47:用树莓派给智能手机发送推送通知
  18. MySQL主从复制bug记录
  19. 计算机电源功率计算器,装机不用愁 航嘉功率计算器教你选电源
  20. 如何让AR拥有镜子的反光效果(ios)

热门文章

  1. docker 时区_腾讯云上用Docker建立Kiftd服务器
  2. spark 动态预加载数据_Spark+TDengine 在中国电信电力测功系统监控平台上的应用实践...
  3. linux vnc开启防火墙,[转载]CentOS 6.0 下 VNC 配置方法(带防火墙配置)
  4. oracle表增加序列字段,Oracle创建表和创建序列和修改,增加sql字段
  5. html5实时预览,对决JavaScript HTML5脚本API预览
  6. 关于linux内核版本说法,关于Linux内核版本的说法,以下错误的是( )
  7. Lost Cows POJ 2182 思维+巧法
  8. Python之路,Day21 - 常用算法学习
  9. UART接口基本知识
  10. 将博客搬至CSDN(放弃)