IT数码 购物 网址 头条 软件 日历 阅读 图书馆
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
图片批量下载器
↓批量下载图片,美女图库↓
图片自动播放器
↓图片自动播放器↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁
 
   -> C++知识库 -> 大一计科生的福利:史上功能最全,代码最简单的学生成绩管理系统,保你课设必过! -> 正文阅读

[C++知识库]大一计科生的福利:史上功能最全,代码最简单的学生成绩管理系统,保你课设必过!

? ? ? ? 很多大一的同学刚接触C语言都有过被课设困扰的烦恼吧,别担心,幸好你刷到了我这篇文章,本人结合C语言的学习经验和对面向过程开发的理解,特意写了一个关于学生成绩管理系统的程序,希望给还在抓耳挠腮的你一丝丝的灵感。

????????

? ?(一)项目需求:

?

学习成绩管理系统功能示意图

?

(二)成品 展示:

?

封面

?

?

录入界面

?

?

成绩排名

?

?

删除

?

?

删除后排名

?

?

新增

?

?

标题

?

?

查询

?

?

查询菜单

?

?注:背景颜色是窗口属性调节的,不是代码弄的!

(三)程序剖析

头文件:

#include<iostream>????????//引用c++的输入输出流,方便输入输出字符串
#include<conio.h>????????//引用控制台头文件,调用函数getch()等待键盘输入
#include<stdlib.h>? ? ? ? //C语言标准库头文件可调用多种基础函数
#include<stdio.h>? ? ? ? //C语言的输入输出头文件

using namespace std;? ? ? ? //调用c++标准库,功能强大

?

?学生结构体:

struct students
{
?? ?string name;//姓名?
?? ?string num;//学号?
?? ?int chinese;//语文成绩?
?? ?int math;//数学成绩?
?? ?int english;//英语成绩?? ??? ?
?? ?int sum;//总分?
?? ?int rank;//排名?
}stu[100];

中间学生结构体:

//用于后续"删除”功能的使用,后面会详解。

struct student
{
?? ?string name;//姓名?
?? ?string num;//学号?
?? ?int chinese;//语文成绩?
?? ?int math;//数学成绩?
?? ?int english;//英语成绩?? ??? ?
?? ?int sum;//总分?
?? ?int rank;//排名?
}_stu[100];

函数声明:

void cover();//封面函数声明?
void menu_main();//主菜单函数声明
void menu_search();//搜索菜单函数声明
void menu_single();//单科成绩菜单函数声明

功能实现:

1、录入学生信息

	cout<<"Please enter the number of students:"<<endl;
	cin>>n;
	cout<<"Please enter student information:"<<endl;
	cout<<"INCLUDE:";
	for(int i = 1; i <= n; i++)
	{
		cout<<endl<<"Name : "; cin>>stu[i].name;
		cout<<"Numbers : "; cin>>stu[i].num;
		cout<<"Chinese score : "; cin>>stu[i].chinese;
		cout<<"Math score    : "; cin>>stu[i].math;
		cout<<"English score : "; cin>>stu[i].english;
		stu[i].sum = stu[i].chinese + stu[i].math + stu[i].english;
	}

2、学生成绩排名

	//冒泡排序
		for(int i = 1; i <= n ; i++)
		{
			for(int j = i+1 ; j <= n ; j++)
			{
				if(stu[j].sum>stu[i].sum)
				{
					//根据总分排序
					int temp = stu[j].sum;
					stu[j].sum = stu[i].sum;
					stu[i].sum = temp;
					//更换学号 
					string temp0 = stu[j].num;
					stu[j].num = stu[i].num;				
					stu[i].num = temp0;	
					//更换名字 
					string temp1 = stu[j].name;
					stu[j].name = stu[i].name;
					stu[i].name = temp1;
					//更换语文成绩 
					int temp2 = stu[j].chinese;
					stu[j].chinese = stu[i].chinese;
					stu[i].chinese = temp2;
					//更换数学成绩 
					int temp3 = stu[j].math;
					stu[j].math = stu[i].math;				
					stu[i].math = temp3;		
					//更换英语成绩 
					int temp4 = stu[j].english;
					stu[j].english = stu[i].english;				
					stu[i].english = temp4;		
				}		
			}
		}

3、删除学生信息

算法:

?

string del_name;
	//	struct students _stu[100];
		cout<<"Please enter the name of the student whose grade you wish to delete(请输入你要删除成绩的学生的姓名):";
		cin>>del_name;
		for(int i = 1; i <= n; i++)
		{
			if(del_name == stu[i].name)//找到了 
			{
			//	_stu[i].name = "\\";//   \ -是转义字符 
			//	_stu[i].num = "\\" ; 
				for(int j = 1; j <= i-1; j++)
				{
					_stu[j].name = stu[j].name;//将i前面的数据转移  
					_stu[j].num = stu[j].num;
					_stu[j].chinese = stu[j].chinese;
					_stu[j].math = stu[j].math;
					_stu[j].english = stu[j].english;
					_stu[j].sum = stu[j].sum;
				}
				//显然,_stu[i]中和i对应的数据是空的,但是没关系,重新排序就好了 ,此行必在最后面 
				//name = ' ',num = ' ', c = 0, m = 0, e = 0 ,sum = 0,r = ? 
				for(int j = i+1; j <= n; j++)
				{
					_stu[j-1].name = stu[j].name;//将i后面的数据转移  
					_stu[j-1].num = stu[j].num;
					_stu[j-1].chinese = stu[j].chinese;
					_stu[j-1].math = stu[j].math;
					_stu[j-1].english = stu[j].english;
					_stu[j-1].sum = stu[j].sum;
				}
				n = n - 1;//点睛之笔, 别忘了让整体的数组元素少一 
				for(int k = 1; k <= n; k++)
				{
					stu[k].name = _stu[k].name;//换回 
					stu[k].num = _stu[k].num;
					stu[k].chinese = _stu[k].chinese;
					stu[k].math = _stu[k].math;
					stu[k].english = _stu[k].english;
					stu[k].sum = _stu[k].sum;		
				} 
				 
			}
		}

4、查询学生成绩

//基本上就是字符串比较
	
int mark;
	do{
		menu_search();
		cin>>mark;
		if(mark == 1)
		{
			string num;
			cout<<"Input number:";
			cin>>num;
			for(int i = 1; i <= n; i++)
			{
				if(num == stu[i].num)
				{
					cout<<"Name : "<<stu[i].name<<endl;
					cout<<"Chinese score : "<<stu[i].chinese<<endl;
					cout<<"Math score : "<<stu[i].math<<endl;
					cout<<"Englsih score : "<<stu[i].english<<endl;
					cout<<"Sum of score : "<<stu[i].sum<<endl;
					cout<<"Rank of student "<<stu[i].rank<<endl;
					getch();
				}
			}
		}
		if(mark == 2)
		{
			string name;
			cout<<"Input name : ";
			cin>>name;
			for(int i = 1; i <= n; i++)
			{
				if(name == stu[i].name)
				{
					cout<<"Number : "<<stu[i].num<<endl;
					cout<<"Chinese score : "<<stu[i].chinese<<endl;
					cout<<"Math score : "<<stu[i].math<<endl;
					cout<<"Englsih score : "<<stu[i].english<<endl;
					cout<<"Sum of score : "<<stu[i].sum<<endl;
					cout<<"Rank of student "<<stu[i].rank<<endl;
					getch();
				}
			}
		}
		if(mark == 3)
		{
			int sum;
			cout<<"Input sum of score : ";
			cin>>sum;
			for(int i = 1; i <= n; i++)
			{
				if(sum == stu[i].sum)
				{
					cout<<"Number : "<<stu[i].num<<endl;
					cout<<"Name : "<<stu[i].name<<endl;
					cout<<"Chinese score : "<<stu[i].chinese<<endl;
					cout<<"Math score : "<<stu[i].math<<endl;
					cout<<"Englsih score : "<<stu[i].english<<endl;
					cout<<"Rank of student "<<stu[i].rank<<endl;
					getch();
				}
			}
		}
		if(mark == 4)
		{
			int find;
			int search;
		do{	
			menu_single();
			cin>>find;
			
			if(find == 1)//查语文 
			{
				for(int i = 1; i <= n; i++)
				{
					_stu[i].name = stu[i].name;
					_stu[i].num = stu[i].num;
					_stu[i].chinese = stu[i].chinese;	
				}
				for(int i = 1; i <= n; i++)	
				{
					for(int j = i+1; j <= n; j++)
					{
						if(_stu[i].chinese < _stu[j].chinese)
						{	//更换语文成绩 
							int temp2 = _stu[j].chinese;
							_stu[j].chinese = _stu[i].chinese;
							_stu[i].chinese = temp2;
							//更换学号 
							string temp0 = _stu[j].num;
							_stu[j].num = _stu[i].num;				
							_stu[i].num = temp0;	
							//更换名字 
							string temp1 = _stu[j].name;
							_stu[j].name = _stu[i].name;
							_stu[i].name = temp1;
						}
					}
				}
				cout<<"Chinese transcripts : "<<endl; 
				cout<<"Name\tNumber\tChinese : "<<endl;	
				for(int i = 1; i <= n; i++)
				{
					cout<<_stu[i].name<<'\t'<<_stu[i].num<<'\t'<<_stu[i].chinese<<endl;
				}
				cout<<"Failure list of Chinese grades (score < 60 ): "<<endl;
				cout<<"Name\tNumber\tChinese : "<<endl;		
				for(int i = 1; i <= n; i++)
				{
					if(_stu[i].chinese < 60)
						cout<<_stu[i].name<<'\t'<<_stu[i].num<<'\t'<<_stu[i].chinese<<endl;
				}
				cout<<"For a quick search, press 5,(快捷搜索);"<<"Return to the parent directory , press 0 "<<endl;
				cin>>search;
				if(search == 5)
				{
				do{
					system("cls");
					int con;
					string S_name,S_num;
					cout<<"[Quick search]"<<endl<<endl;
					cout<<"Press '1' to continue,press '0' to stop ."<<endl;
					getch();
					cin>>con;
					if(con == 1)
					{
						cout<<"Please enter the name and student id"<<endl;
						cout<<"Name: "; cin>>S_name; cout<<"ID : "; cin>>S_num;
						for(int i = 1; i <= n; i++)
						{
							if(S_name == _stu[i].name && S_num == _stu[i].num)
							{
								cout<<"Chinese : "<<_stu[i].chinese<<endl;	
							}	
						} 
						getch();
					}
					if(con == 0)
						search = 0;
				  }while( search!= 0);
				}
				cout<<"After the display is complete, press any key to return to the parent directory (@^V^@);"<<endl;
				getch();
			}

?

5、修改学生成绩

	string name,_name,num;
		int chinese,math,english,sum;
		cout<<"Please enter the name of the person whose score you want to change:(你要修改谁的成绩?):";
		cin>>name;
		cout<<"Please re-enter the correct information (请重新输入正确的信息):"<<endl;
		cout<<"Name : "<<' '; cin>>_name;
		cout<<"Number : "<<' '; cin>>num;
		cout<<"Chinese : "<<' '; cin>>chinese;
		cout<<"English : "<<' '; cin>>english;
		cout<<"Math : "<<' '; cin>>math;
		sum = chinese + english + math;
		for(int i = 1; i <= n; i++)
		{
			if(name == stu[i].name)
			{
					stu[i].name = _name; 
					stu[i].num = num;
					stu[i].chinese = chinese;
					stu[i].math = math;
					stu[i].english = english;
					stu[i].sum = sum;
			}
		} 

6、显示学生成绩

		system("cls");//清屏函数
		cout<<"Student grades are as follows:"<<endl;
		cout<<"学号\t姓名\t语文\t数学\t英语\t总分\t名次"<<endl;
		for(int i = 1; i <= n; i++)
		{
			stu[i].rank = i;
			cout<<stu[i].num<<'\t'<<stu[i].name<<'\t'<<stu[i].
			chinese<<'\t'<<stu[i].math<<'\t'<<stu[i].english<<
			'\t'<<stu[i].sum<<'\t'<<stu[i].rank<<endl;
		}
		getch();

注:单科成绩单与不及格名单都在查询功能模块内,详细功能请参考下面完整代码。

(四)程序源代码

#include<iostream>
#include<conio.h>
#include<stdlib.h>
#include<stdio.h>

using namespace std;

struct students
{
	string name;//姓名 
	string num;//学号 
	int chinese;//语文成绩 
	int math;//数学成绩 
	int english;//英语成绩		
	int sum;//总分 
	int rank;//排名 
}stu[100];
//替身 
struct student
{
	string name;//姓名 
	string num;//学号 
	int chinese;//语文成绩 
	int math;//数学成绩 
	int english;//英语成绩		
	int sum;//总分 
	int rank;//排名 
}_stu[100];

void cover();//封面函数声明 
void menu_main();
void menu_search();
void menu_single();

int main()
{
	cover();
	getch();
	int n;
	int flag;
	system("cls");
	cout<<"Please enter the number of students:"<<endl;
	cin>>n;
	cout<<"Please enter student information:"<<endl;
	cout<<"INCLUDE:"<<endl;
	for(int i = 1; i <= n; i++)
	{
		cout<<"----------------the number of "<<i<<" student:-------------------"<<endl; 
		cout<<"Name : "; cin>>stu[i].name;
		cout<<"Numbers : "; cin>>stu[i].num;
		cout<<"Chinese score : "; cin>>stu[i].chinese;
		cout<<"Math score    : "; cin>>stu[i].math;
		cout<<"English score : "; cin>>stu[i].english;
		stu[i].sum = stu[i].chinese + stu[i].math + stu[i].english;
	}
	
do{	
	menu_main(); 
	cin>>flag;
	if(flag == 1)//新加一位
	{
		n = n+1;
		cout<<"Please enter new student information : "<<endl;
		cout<<"INCLUDE:";
		cout<<endl<<"Name : "; cin>>stu[n].name;
		cout<<"Numbers : "; cin>>stu[n].num;
		cout<<"Chinese score : "; cin>>stu[n].chinese;
		cout<<"Math score    : "; cin>>stu[n].math;
		cout<<"English score : "; cin>>stu[n].english;
		stu[n].sum = stu[n].chinese + stu[n].math + stu[n].english;
		cout<<"Add to complete (^v^)!"<<endl;
		getch();
	} 
	
	if(flag == 2)//成绩排名 
	{
		//冒泡排序
		for(int i = 1; i <= n ; i++)
		{
			for(int j = i+1 ; j <= n ; j++)
			{
				if(stu[j].sum>stu[i].sum)
				{
					//根据总分排序
					int temp = stu[j].sum;
					stu[j].sum = stu[i].sum;
					stu[i].sum = temp;
					//更换学号 
					string temp0 = stu[j].num;
					stu[j].num = stu[i].num;				
					stu[i].num = temp0;	
					//更换名字 
					string temp1 = stu[j].name;
					stu[j].name = stu[i].name;
					stu[i].name = temp1;
					//更换语文成绩 
					int temp2 = stu[j].chinese;
					stu[j].chinese = stu[i].chinese;
					stu[i].chinese = temp2;
					//更换数学成绩 
					int temp3 = stu[j].math;
					stu[j].math = stu[i].math;				
					stu[i].math = temp3;		
					//更换英语成绩 
					int temp4 = stu[j].english;
					stu[j].english = stu[i].english;				
					stu[i].english = temp4;		
				}		
			}
		}
		//rank
		for(int i = 1; i <= n; i++)
		{
			stu[i].rank = i;
		}
		cout<<"The student ranking is complete !(^v^)!"<<endl;
		getch(); 
	} 
	
	if(flag == 3)//查询学生成绩 
	{
		int mark;
	do{
		menu_search();
		cin>>mark;
		if(mark == 1)
		{
			string num;
			cout<<"Input number:";
			cin>>num;
			for(int i = 1; i <= n; i++)
			{
				if(num == stu[i].num)
				{
					cout<<"Name : "<<stu[i].name<<endl;
					cout<<"Chinese score : "<<stu[i].chinese<<endl;
					cout<<"Math score : "<<stu[i].math<<endl;
					cout<<"Englsih score : "<<stu[i].english<<endl;
					cout<<"Sum of score : "<<stu[i].sum<<endl;
					cout<<"Rank of student "<<stu[i].rank<<endl;
					getch();
				}
			}
		}
		if(mark == 2)
		{
			string name;
			cout<<"Input name : ";
			cin>>name;
			for(int i = 1; i <= n; i++)
			{
				if(name == stu[i].name)
				{
					cout<<"Number : "<<stu[i].num<<endl;
					cout<<"Chinese score : "<<stu[i].chinese<<endl;
					cout<<"Math score : "<<stu[i].math<<endl;
					cout<<"Englsih score : "<<stu[i].english<<endl;
					cout<<"Sum of score : "<<stu[i].sum<<endl;
					cout<<"Rank of student "<<stu[i].rank<<endl;
					getch();
				}
			}
		}
		if(mark == 3)
		{
			int sum;
			cout<<"Input sum of score : ";
			cin>>sum;
			for(int i = 1; i <= n; i++)
			{
				if(sum == stu[i].sum)
				{
					cout<<"Number : "<<stu[i].num<<endl;
					cout<<"Name : "<<stu[i].name<<endl;
					cout<<"Chinese score : "<<stu[i].chinese<<endl;
					cout<<"Math score : "<<stu[i].math<<endl;
					cout<<"Englsih score : "<<stu[i].english<<endl;
					cout<<"Rank of student "<<stu[i].rank<<endl;
					getch();
				}
			}
		}
		if(mark == 4)
		{
			int find;
			int search;
		do{	
			menu_single();
			cin>>find;
			
			if(find == 1)//查语文 
			{
				for(int i = 1; i <= n; i++)
				{
					_stu[i].name = stu[i].name;
					_stu[i].num = stu[i].num;
					_stu[i].chinese = stu[i].chinese;	
				}
				for(int i = 1; i <= n; i++)	
				{
					for(int j = i+1; j <= n; j++)
					{
						if(_stu[i].chinese < _stu[j].chinese)
						{	//更换语文成绩 
							int temp2 = _stu[j].chinese;
							_stu[j].chinese = _stu[i].chinese;
							_stu[i].chinese = temp2;
							//更换学号 
							string temp0 = _stu[j].num;
							_stu[j].num = _stu[i].num;				
							_stu[i].num = temp0;	
							//更换名字 
							string temp1 = _stu[j].name;
							_stu[j].name = _stu[i].name;
							_stu[i].name = temp1;
						}
					}
				}
				cout<<"Chinese transcripts : "<<endl; 
				cout<<"Name\tNumber\tChinese : "<<endl;	
				for(int i = 1; i <= n; i++)
				{
					cout<<_stu[i].name<<'\t'<<_stu[i].num<<'\t'<<_stu[i].chinese<<endl;
				}
				cout<<"Failure list of Chinese grades (score < 60 ): "<<endl;
				cout<<"Name\tNumber\tChinese : "<<endl;		
				for(int i = 1; i <= n; i++)
				{
					if(_stu[i].chinese < 60)
						cout<<_stu[i].name<<'\t'<<_stu[i].num<<'\t'<<_stu[i].chinese<<endl;
				}
				cout<<"For a quick search, press 5,(快捷搜索);"<<"Return to the parent directory , press 0 "<<endl;
				cin>>search;
				if(search == 5)
				{
				do{
					system("cls");
					int con;
					string S_name,S_num;
					cout<<"[Quick search]"<<endl<<endl;
					cout<<"Press '1' to continue,press '0' to stop ."<<endl;
					getch();
					cin>>con;
					if(con == 1)
					{
						cout<<"Please enter the name and student id"<<endl;
						cout<<"Name: "; cin>>S_name; cout<<"ID : "; cin>>S_num;
						for(int i = 1; i <= n; i++)
						{
							if(S_name == _stu[i].name && S_num == _stu[i].num)
							{
								cout<<"Chinese : "<<_stu[i].chinese<<endl;	
							}	
						} 
						getch();
					}
					if(con == 0)
						search = 0;
				  }while( search!= 0);
				}
				cout<<"After the display is complete, press any key to return to the parent directory (@^V^@);"<<endl;
				getch();
			}
			
			if(find == 2)//查数学
			{
				for(int i = 1; i <= n; i++)
				{
					_stu[i].name = stu[i].name;
					_stu[i].num = stu[i].num;
					_stu[i].math = stu[i].math;	
				}
				for(int i = 1; i <= n; i++)	
				{
					for(int j = i+1; j <= n; j++)
					{
						if(_stu[i].math < _stu[j].math)
						{	//更换数学成绩 
							int temp2 = _stu[j].math;
							_stu[j].math = _stu[i].math;
							_stu[i].math = temp2;
							//更换学号 
							string temp0 = _stu[j].num;
							_stu[j].num = _stu[i].num;				
							_stu[i].num = temp0;	
							//更换名字 
							string temp1 = _stu[j].name;
							_stu[j].name = _stu[i].name;
							_stu[i].name = temp1;
						}
					}
				}
				cout<<"math transcripts : "<<endl; 
				cout<<"Name\tNumber\tMath : "<<endl;
				for(int i = 1; i <= n; i++)
				{
					cout<<_stu[i].name<<'\t'<<_stu[i].num<<'\t'<<_stu[i].math<<endl;
				}
				cout<<"Failure list of math grades (score < 60 ): "<<endl;
				cout<<"Name\tNumber\tMath : "<<endl;
				for(int i = 1; i <= n; i++)
				{
					if(_stu[i].math < 60)
						cout<<_stu[i].name<<'\t'<<_stu[i].num<<'\t'<<_stu[i].math<<endl;
				}
				cout<<"For a quick search, press 5,(快捷搜索);"<<"Return to the parent directory , press 0 "<<endl;
				cin>>search;
				if(search == 5)
				{
				do{
					system("cls");
					int con;
					string S_name,S_num;
					cout<<"[Quick search]"<<endl<<endl;
					cout<<"Press '1' to continue,press '0' to stop ."<<endl;
					getch();
					cin>>con;
					if(con == 1)
					{
						cout<<"Please enter the name and student id"<<endl;
						cout<<"Name: "; cin>>S_name; cout<<"ID : "; cin>>S_num;
						for(int i = 1; i <= n; i++)
						{
							if(S_name == _stu[i].name && S_num == _stu[i].num)
							{
								cout<<"Math : "<<_stu[i].math<<endl;	
							}	
						} 
						getch();
					}
					if(con == 0)
						search = 0;
				  }while( search!= 0);
				}				
				cout<<"After the display is complete, press any key to return to the parent directory(@^V^@);"<<endl;
				getch();
			}
			
			if(find == 3)//查英语
			{
				for(int i = 1; i <= n; i++)
				{
					_stu[i].name = stu[i].name;
					_stu[i].num = stu[i].num;
					_stu[i].english = stu[i].english;	
				}
				for(int i = 1; i <= n; i++)	
				{
					for(int j = i+1; j <= n; j++)
					{
						if(_stu[i].english < _stu[j].english)
						{
							//更换英语成绩 
							int temp2 = _stu[j].english;
							_stu[j].english = _stu[i].english;
							_stu[i].english = temp2;
							//更换学号 
							string temp0 = _stu[j].num;
							_stu[j].num = _stu[i].num;				
							_stu[i].num = temp0;	
						//更换名字 
							string temp1 = _stu[j].name;
							_stu[j].name = _stu[i].name;
							_stu[i].name = temp1;
						}
					}
				}
				cout<<"english transcripts : "<<endl;
				cout<<"Name\tNumber\tEnglish : "<<endl; 
				for(int i = 1; i <= n; i++)
				{
					cout<<_stu[i].name<<'\t'<<_stu[i].num<<'\t'<<_stu[i].english<<endl;
				}
				cout<<"Failure list of english grades (score < 60 ): "<<endl;
				cout<<"Name\tNumber\tEnglish : "<<endl;	
				for(int i = 1; i <= n; i++)
				{
					if(_stu[i].english < 60)
						cout<<_stu[i].name<<'\t'<<_stu[i].num<<'\t'<<_stu[i].english<<endl;
				}
				cout<<"For a quick search, press 5,(快捷搜索);"<<"Return to the parent directory , press 0 "<<endl;
				cin>>search;
				if(search == 5)
				{
				do{
					system("cls");
					int con;
					string S_name,S_num;
					cout<<"[Quick search]"<<endl<<endl;
					cout<<"Press '1' to continue,press '0' to stop ."<<endl;
					getch();
					cin>>con;
					if(con == 1)
					{
						cout<<"Please enter the name and student id"<<endl;
						cout<<"Name: "; cin>>S_name; cout<<"ID : "; cin>>S_num;
						for(int i = 1; i <= n; i++)
						{
							if(S_name == _stu[i].name && S_num == _stu[i].num)
							{
								cout<<"English : "<<_stu[i].english<<endl;	
							}	
						} 
						getch();
					}
					if(con == 0)
						search = 0;
				  }while( search!= 0);
				}				
				cout<<"After the display is complete, press any key to return to the parent directory(@^V^@);"<<endl;
				getch();
			}
			 
		}while(find != 0);
		} 
	}while(mark != 0);
		cout<<"All content is displayed"<<endl;
		getch();
	}
	
	if(flag == 4)//修改成绩 
	{
		string name,_name,num;
		int chinese,math,english,sum;
		cout<<"Please enter the name of the person whose score you want to change:(你要修改谁的成绩?):";
		cin>>name;
		cout<<"Please re-enter the correct information (请重新输入正确的信息):"<<endl;
		cout<<"Name : "<<' '; cin>>_name;
		cout<<"Number : "<<' '; cin>>num;
		cout<<"Chinese : "<<' '; cin>>chinese;
		cout<<"English : "<<' '; cin>>english;
		cout<<"Math : "<<' '; cin>>math;
		sum = chinese + english + math;
		for(int i = 1; i <= n; i++)
		{
			if(name == stu[i].name)
			{
					stu[i].name = _name; 
					stu[i].num = num;
					stu[i].chinese = chinese;
					stu[i].math = math;
					stu[i].english = english;
					stu[i].sum = sum;
			}
		} 
		cout<<"Modified completed !(^v^)!"<<endl;
		getch();
	}	
	if(flag == 5)//删除成绩
	{
		string del_name;
	//	struct students _stu[100];
		cout<<"Please enter the name of the student whose grade you wish to delete(请输入你要删除成绩的学生的姓名):";
		cin>>del_name;
		for(int i = 1; i <= n; i++)
		{
			if(del_name == stu[i].name)//找到了 
			{
			//	_stu[i].name = "\\";//   \ -是转义字符 
			//	_stu[i].num = "\\" ; 
				for(int j = 1; j <= i-1; j++)
				{
					_stu[j].name = stu[j].name;//将i前面的数据转移  
					_stu[j].num = stu[j].num;
					_stu[j].chinese = stu[j].chinese;
					_stu[j].math = stu[j].math;
					_stu[j].english = stu[j].english;
					_stu[j].sum = stu[j].sum;
				}
				//显然,_stu[i]中和i对应的数据是空的,但是没关系,重新排序就好了 ,此行必在最后面 
				//name = ' ',num = ' ', c = 0, m = 0, e = 0 ,sum = 0,r = ? 
				for(int j = i+1; j <= n; j++)
				{
					_stu[j-1].name = stu[j].name;//将i后面的数据转移  
					_stu[j-1].num = stu[j].num;
					_stu[j-1].chinese = stu[j].chinese;
					_stu[j-1].math = stu[j].math;
					_stu[j-1].english = stu[j].english;
					_stu[j-1].sum = stu[j].sum;
				}
				n = n - 1;//点睛之笔, 别忘了让整体的数组元素少一 
				for(int k = 1; k <= n; k++)
				{
					stu[k].name = _stu[k].name;//换回 
					stu[k].num = _stu[k].num;
					stu[k].chinese = _stu[k].chinese;
					stu[k].math = _stu[k].math;
					stu[k].english = _stu[k].english;
					stu[k].sum = _stu[k].sum;		
				} 
				 
			}
		}
		cout<<"Delete finished, please reorder(删除完毕,请重新排序)!(^v^)!"<<endl;
		getch();
	}

	if(flag == 6)//显示学生成绩信息
	{
		system("cls");
		cout<<"Student grades are as follows:"<<endl;
		cout<<"学号\t姓名\t语文\t数学\t英语\t总分\t名次"<<endl;
		for(int i = 1; i <= n; i++)
		{
			stu[i].rank = i;
			cout<<stu[i].num<<'\t'<<stu[i].name<<'\t'<<stu[i].
			chinese<<'\t'<<stu[i].math<<'\t'<<stu[i].english<<
			'\t'<<stu[i].sum<<'\t'<<stu[i].rank<<endl;
		}
		getch();
	} 
	
}while(flag != 0);
	
	return 0;	
} 
void cover()
{
		cout<<"====================================================================================="<<endl<<"*"
	<<"                                                                                   *"<<endl<<"*"
	<<"                                                                                   *"<<endl<<"*"
	<<"                                                                                   *"<<endl<<"*"
	<<"                                                                                   *"<<endl<<"*"
	<<"                                                                                   *"<<endl<<"*"
	<<"                                                                                   *"<<endl<<"*"
	<<"                                                                                   *"<<endl<<"*"
	<<"                                                                                   *"<<endl<<"*"
	<<"                                                                                   *"<<endl<<"*"
	<<"                                                                                   *"<<endl;
	cout<<"*                Welcome to the Student Achievement Management System               *"<<endl;//欢迎使用学生成绩管理系统 
	cout<<"*                       ( 欢 迎 使 用 学 生 成 绩 管 理 系 统 )                     *" <<endl;
	cout<<"*                                                                                   *"<<endl<<
	"*                                                                                   *"<<endl
	<<"*                                                                                   *"<<endl
	<<"*                                                                                   *"<<endl
	<<"*                                                                                   *"<<endl
	<<"*                                                                                   *"<<endl
	<<"*                                                                                   *"<<endl
	<<"*                                                                                   *"<<endl
	<<"*                                                                                   *"<<endl
	<<"*                                                                                   *"<<endl
	<<"*                                                                                   *"<<endl
	<<"=====================================================================================";
}

void menu_main()//主页菜单
{
	system("cls");
	cout<<endl;
	cout<<"====================================================================================="<<endl;
	cout<<"*                                  The home page menu                               *"<<endl;
	cout<<"====================================================================================="<<endl;	
	cout<<"*                      1 : Add(添加) a new classmate information;                 *"<<endl;
	cout<<"*                      2 : Student Achievement Ranking(排名);                     *"<<endl;
	cout<<"*                      3 : Inquire(查询) student grades information;                *"<<endl;
	cout<<"*                      4 : Change(修改) student grades information;                 *"<<endl;
	cout<<"*                      5 : Delete(删除) student grades information;                 *"<<endl;
	cout<<"*                      6 : Display(展示) student information;                     *"<<endl;
	cout<<"*                      0 : Pressing '0' : Exit to system ;                          *"<<endl;
	cout<<"====================================================================================="<<endl;
} 
void menu_search()//查询菜单
{
	system("cls");
	cout<<endl;
	cout<<"-------------------------------------------------------------------------------------"<<endl;
	cout<<"*                                     Inquiry Modes:                                *"<<endl;
	cout<<"-------------------------------------------------------------------------------------"<<endl;
	cout<<"*                              1:Student number query;                             *"<<endl;
	cout<<"*                              2:Name query;                                       *"<<endl;
	cout<<"*                              3:Total score query;                                *"<<endl;		
	cout<<"*                              4: Single subject score(单科成绩) query              *"<<endl;
	cout<<"*                                 and fail statistics(不及格统计);                *"<<endl;
	cout<<"*                              0: Return main menu.                                 *"<<endl;
	cout<<"-------------------------------------------------------------------------------------"<<endl;
}
void menu_single()//单科查询 
{
	system("cls");
	cout<<endl;
	cout<<"-------------------------------------------------------------------------------------"<<endl;
	cout<<"*                                   Subjects area :                                 *"<<endl;
	cout<<"-------------------------------------------------------------------------------------"<<endl;
	cout<<"*                               1: Chinese transcript;                              *"<<endl;
	cout<<"*                               2: Math transcript;                                 *"<<endl;
	cout<<"*                               3: English transcript;                              *"<<endl;
	cout<<"*                               0: Return to the parent directory;                  *"<<endl;
	cout<<"*                               Attention: Press the 1 or 2 or 3 key to select;     *"<<endl;
	cout<<"-------------------------------------------------------------------------------------"<<endl;
}	

注:本程序全部采用面向过程编程,思路和逻辑都属于C语言范畴,但输入输出为了方便都采用了cout,cin等高级语法,读者可自行更改;并且大量提示信息都采用英文书写更显高级感,读者觉得看着不方便也可自行改成中文;最后,谢谢大家的阅读与采纳。

  C++知识库 最新文章
【C++】友元、嵌套类、异常、RTTI、类型转换
通讯录的思路与实现(C语言)
C++PrimerPlus 第七章 函数-C++的编程模块(
Problem C: 算法9-9~9-12:平衡二叉树的基本
MSVC C++ UTF-8编程
C++进阶 多态原理
简单string类c++实现
我的年度总结
【C语言】以深厚地基筑伟岸高楼-基础篇(六
c语言常见错误合集
上一篇文章      下一篇文章      查看所有文章
加:2021-08-06 15:54:00  更:2021-08-06 15:54:17 
 
开发: C++知识库 Java知识库 JavaScript Python PHP知识库 人工智能 区块链 大数据 移动开发 嵌入式 开发工具 数据结构与算法 开发测试 游戏开发 网络协议 系统运维
教程: HTML教程 CSS教程 JavaScript教程 Go语言教程 JQuery教程 VUE教程 VUE3教程 Bootstrap教程 SQL数据库教程 C语言教程 C++教程 Java教程 Python教程 Python3教程 C#教程
数码: 电脑 笔记本 显卡 显示器 固态硬盘 硬盘 耳机 手机 iphone vivo oppo 小米 华为 单反 装机 图拉丁

360图书馆 购物 三丰科技 阅读网 日历 万年历 2024年5日历 -2024/5/10 2:38:17-

图片自动播放器
↓图片自动播放器↓
TxT小说阅读器
↓语音阅读,小说下载,古典文学↓
一键清除垃圾
↓轻轻一点,清除系统垃圾↓
图片批量下载器
↓批量下载图片,美女图库↓
  网站联系: qq:121756557 email:121756557@qq.com  IT数码