Home
>
java文档管理系统
>
c 学生管理系统文档
c 学生管理系统文档

time:2020-07-30 09:18:43

author:重庆佰鼎科技有限公司

【Font size: big medium smail

本文由重庆佰鼎科技有限公司提供,重点介绍了c 学生管理系统文档相关内容。重庆佰鼎科技有限公司专业提供java文档管理系统,git 管理的文档,文档 版本管理等多项产品服务。我司拥有一批高专业性的员工。我们一贯秉承诚实、守信、认真负责的工作态度,深受广大客户的好评!

c 学生管理系统文档实现功能预览https://www.zhihu.com/video/1220355498354171904using System;

using System.Collections.Generic;

using System.Linq;

using System.Text;

using System.Threading.Tasks;

namespace _学生管理系统

{

public struct Student

{

public string Name;//定义名字

public string Xuehao;//定义学号

public string Class;//班级

public int Age;//年龄

public string Sex;//性别

public double Score;//成绩

}

class Program

{

static Student[] stu = new Student[20];

static int count;

//初始化数组

public static void moren()//默认的五位同学信息

{

stu[0].Xuehao = "0001";

stu[0].Name = "小贱";

stu[0].Class = "1903";

stu[0].Age = 19;

stu[0].Sex = "男";

stu[0].Score = 400;

stu[1].Xuehao = "0002";

stu[1].Name = "老凡";

stu[1].Class = "1903";

stu[1].Age = 18;

stu[1].Sex = "女";

stu[1].Score = 450;

stu[2].Xuehao = "0003";

stu[2].Name = "小鹿";

stu[2].Class = "1903";

stu[2].Age = 18;

stu[2].Sex = "女";

stu[2].Score = 460;

stu[3].Xuehao = "0004";

stu[3].Name = "小梅";

stu[3].Class = "1903";

stu[3].Age = 18;

stu[3].Sex = "男";

stu[3].Score = 350;

stu[4].Xuehao = "0005";

stu[4].Name = "小柒";

stu[4].Class = "1903";

stu[4].Age = 18;

stu[4].Sex = "男";

stu[4].Score = 390;

count = 5;

}

public static void Man()//主菜单

{

Console.WriteLine("1.查询学生信息");

Console.WriteLine("2.录入学生信息");

Console.WriteLine("3.修改学生信息");

Console.WriteLine("4.删除学生信息");

Console.WriteLine("5.退出");

}

public static void AddStudent()

{

string flag;

do

{

Console.WriteLine("请输入学号:");

stu[count].Xuehao = Console.ReadLine();

Console.WriteLine("请输入姓名:");

stu[count].Name = Console.ReadLine();

Console.WriteLine("请输入班级:");

stu[count].Class = Console.ReadLine();

Console.WriteLine("请输入年龄:");

stu[count].Age = int.Parse(Console.ReadLine());

Console.WriteLine("请输入性别:");

stu[count].Sex = Console.ReadLine();

Console.WriteLine("请输入成绩:");

stu[count].Score = double.Parse(Console.ReadLine());

count++;

Console.WriteLine("添加成功!是否继续添加(y/n)?");

flag = Console.ReadLine();

} while (flag == "Y" || flag == "y");

} //录入信息功能

public static void FindStudent()

{

string choose;

do

{

Console.WriteLine("1.查询全部");

Console.WriteLine("2.按班级查询");

Console.WriteLine("3.按学号查询");

Console.WriteLine("4.按姓名查询");

Console.WriteLine("5.按分数查询排名");

Console.WriteLine("0.返回上一级菜单");

Console.WriteLine("请选择:");

choose = Console.ReadLine();

switch (choose)

{

case "1":

FindAll();//查询全部

break;

case "2":

FindClass();//查询班级

break;

case "3":

FindXueHao();//查询学号

break;

case "4":

FindName();//按名字查询

break;

case "5":

FindScore();//按成绩查询

break;

case "0":

Console.WriteLine("欢迎再次查询");

break;

}

} while (choose != "0");//等于0则循环,不等于则结束

} //查询界面

//全部查询界面

public static void FindAll()

{

Console.WriteLine("学号\t姓名\t班级\t性别\t年龄\t分数\t");

for (int i = 0; i < count; i++)

{

Console.Write(stu[i].Xuehao + "\t");

Console.Write(stu[i].Name + "\t");

Console.Write(stu[i].Class + "\t");

Console.Write(stu[i].Sex + "\t");

Console.Write(stu[i].Age + "\t");

Console.Write(stu[i].Score + "\t");

Console.WriteLine("");

}

}//查询全部

//按班级查询

public static void FindClass()

{

string BanJi, chooes;

do

{

Console.WriteLine("请输入班级:");

BanJi = Console.ReadLine();

Console.WriteLine("学号\t姓名\t班级\t性别\t年龄\t分数\t");

for (int i = 0; i < count; i++)

{

if (BanJi == stu[i].Class)

{

Console.Write(stu[i].Xuehao + "\t");

Console.Write(stu[i].Name + "\t");

Console.Write(stu[i].Class + "\t");

Console.Write(stu[i].Sex + "\t");

Console.Write(stu[i].Age + "\t");

Console.Write(stu[i].Score + "\t");

Console.WriteLine("");

}

else

{

continue;

}

}

Console.WriteLine("是否继续按班级查询?(y/n)");

chooes = Console.ReadLine();

} while (chooes == "Y" || chooes == "y");

}//查询班级

//按学号查询

public static void FindXueHao()

{

string Xuehao, chooes;

do

{

Console.WriteLine("请输入学号:");

Xuehao = Console.ReadLine();

Console.WriteLine("学号\t姓名\t班级\t性别\t年龄\t分数\t");

for (int i = 0; i < count; i++)

{

if (Xuehao == stu[i].Xuehao)

{

Console.Write(stu[i].Xuehao + "\t");

Console.Write(stu[i].Name + "\t");

Console.Write(stu[i].Class + "\t");

Console.Write(stu[i].Sex + "\t");

Console.Write(stu[i].Age + "\t");

Console.Write(stu[i].Score + "\t");

Console.WriteLine("");

}

else

{

continue;

}

}

Console.WriteLine("是否继续按学号查询?(y/n)");

chooes = Console.ReadLine();

} while (chooes == "Y" || chooes == "y");

}//查询学号

//按姓名查询

public static void FindName()

{

string Name, chooes;

do

{

Console.WriteLine("请输入姓名:");

Name = Console.ReadLine();

Console.WriteLine("学号\t姓名\t班级\t性别\t年龄\t分数\t");

for (int i = 0; i < count; i++)

{

if (Name == stu[i].Name)

{

Console.Write(stu[i].Xuehao + "\t");

Console.Write(stu[i].Name + "\t");

Console.Write(stu[i].Class + "\t");

Console.Write(stu[i].Sex + "\t");

Console.Write(stu[i].Age + "\t");

Console.Write(stu[i].Score + "\t");

Console.WriteLine("");

}

else

{

continue;

}

}

Console.WriteLine("是否继续按姓名查询?(y/n)");

chooes = Console.ReadLine();

} while (chooes == "Y" || chooes == "y");

}//名字查询

static void Bubble()//冒号排序法

{

Student temp = new Student();

for (int i = count; i > 0; i--)

{

for (int j = 0; j < i - 1; j++)

{

if (stu[j].Score < stu[j + 1].Score)

{

temp = stu[j];

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

stu[j + 1] = temp;

}

}

}

}

public static void FindScore()

{

Bubble();

Console.WriteLine("学号\t姓名\t班级\t性别\t年龄\t分数\t排名\t");

for (int i = 0; i < count; i++)

{

Console.Write(stu[i].Xuehao + "\t");

Console.Write(stu[i].Name + "\t");

Console.Write(stu[i].Class + "\t");

Console.Write(stu[i].Sex + "\t");

Console.Write(stu[i].Age + "\t");

Console.Write(stu[i].Score + "\t");

Console.WriteLine("{0}\t", i + 1);

}

}//成绩排名查询

public static void ShanChuXueHao() //输入学号删除信息

{

Console.WriteLine("请输入学号:");

string stuno = Console.ReadLine();

int index = XHo(stuno);

if (index == -1)

{

Console.WriteLine("输入错误,请重新输入!");

}

else if (index == count - 1)

{

count--;

Console.WriteLine("删除成功!");

}

else

{

for (int i = index; i < count; i++)

{

stu[i] = stu[i + 1];

}

count--;

Console.WriteLine("删除成功!");

}

}

public static int XHo(string stunno)//查找的学号的下标

{

int index = -1;

for (int i = 0; i < count; i++)

{

if (stunno == stu[i].Xuehao)

{

index = i;

break;

}

}

return index;

}

//要修改的学生信息

public static void XinXi(string coun)

{

Console.WriteLine("要修改的学生信息:");

for (int i = 0; i < count; i++)

{

if (coun == stu[i].Xuehao)

{

Console.WriteLine("姓名:" + stu[i].Name);

Console.WriteLine("班级:" + stu[i].Class);

Console.WriteLine("性别:" + stu[i].Sex);

Console.WriteLine("年龄:" + stu[i].Age);

Console.WriteLine("分数:" + stu[i].Score);

}

else

{

continue;

}

}

}

//修改学生信息

public static void XGXX()

{

Console.WriteLine("请输入学号!");

string coun = Console.ReadLine();

XinXi(coun);

Console.WriteLine("请选择要修改的内容:");

Console.WriteLine("1.姓名");

Console.WriteLine("2.班级");

Console.WriteLine("3.性别");

Console.WriteLine("4.年龄");

Console.WriteLine("5.分数");

Console.WriteLine("请选择:");

string a = Console.ReadLine();

for (int i = 0; i < count; i++)

{

if (coun == stu[i].Xuehao)

{

if (a == "1")

{

Console.WriteLine("请输入新的姓名");

stu[i].Name = Console.ReadLine();c 学生管理系统文档

}

else if (a == "2")

{

Console.WriteLine("请输入新的班级");

stu[i].Class = Console.ReadLine();

}

else if (a == "3")

{

Console.WriteLine("请输入新的性别");

stu[i].Sex = Console.ReadLine();

}

else if (a == "4")

{

Console.WriteLine("请输入新的年龄");

stu[i].Age = int.Parse(Console.ReadLine());

}

else if (a == "5")

{

Console.WriteLine("请输入新的分数");

stu[i].Score = float.Parse(Console.ReadLine());

}

Console.WriteLine("修改成功");

}

else

{

continue;

}

}

}

static void Main(string[] args)

{

moren();

int chooes;

do

{

Man();

Console.WriteLine("请选择序号!");

chooes = int.Parse(Console.ReadLine());

switch (chooes)

{

case 1:

FindStudent();

break;

case 2:

AddStudent();

break;c 学生管理系统文档

case 3:

XGXX();

break;

case 4:

ShanChuXueHao();

break;

case 5:

Console.WriteLine("已退出");

break;

default:

Console.WriteLine("输入错误!,请重新输入!");

break;

}

} while (chooes != 5);

}

}

}

Reprint please indicate:http://www.cnsoftweb.com/wdgl-3407.html