⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 display.cpp

📁 学校的教学管理系统
💻 CPP
字号:
#include"head.h"
#include<iostream.h>
#include<string.h>
#include<stdlib.h>

void DisplayBasic(Student* &head)
{
	Student *pGuard;

	for(pGuard=head;pGuard!=NULL;pGuard=pGuard->next)
	{
		cout<<"		学生姓名:		"<<pGuard->Name <<endl;
		
		cout<<"		班级:			"<<pGuard->Class <<endl;
		
		cout<<"		学号:			"<<pGuard->Number <<endl;

		cout<<"		性别:			";
		if(pGuard->Sex==1)
			cout<<"男"<<endl;
		else
			cout<<"女"<<endl;
		
		cout<<"		年龄:			"<<pGuard->Age <<endl;
	
		cout<<"		宿舍号:			"<<pGuard->Room <<endl;

		cout<<"		电话号码:		"<<pGuard->Tel <<endl<<endl<<endl;
	}
}

void DisplayOneBasic(Student* &head)
{
	Student *pGuard;
	int Class,Number;
	char choice;
	char Name[20];

	cout<<"说明:本程序提供①根据学生的学号"
		<<"               ②根据学生姓名和所在的班级"
		<<"               两种方式来查找并显示学生的信息."
		<<endl;
status0:
	cout<<"请选择查找方式(1/2): "<<endl;
	cin>>choice;
	
	if(choice=='1')
	{
status1:
		cout<<"请输入查找的学生的学号:"<<endl;
		cin>>Number;

		for(pGuard=head;pGuard!=NULL;pGuard=pGuard->next)
		{
			if(pGuard->Number==Number)
			{
				cout<<"找到该学生,已记录的信息如下:"<<endl;

				cout<<"		学生姓名:		"<<pGuard->Name <<endl;
		
				cout<<"		班级:			"<<pGuard->Class <<endl;
		
				cout<<"		学号:			"<<pGuard->Number <<endl;

				cout<<"		性别:			";
				if(pGuard->Sex==1)
					cout<<"男"<<endl;
				else
					cout<<"女"<<endl;
		
				cout<<"		年龄:			"<<pGuard->Age <<endl;
	
				cout<<"		宿舍号:			"<<pGuard->Room <<endl;

				cout<<"		电话号码:		"<<pGuard->Tel <<endl;

				return;
			}
		}
		cout<<"没有找到该学生的信息."<<endl;
status2:
		cout<<"要重新输入学生的学号吗?(y/n):";
		cin>>choice;
		if(choice=='y'||choice=='Y')
		{
			cout<<"那么请重新输入吧!"<<endl;
			system("pause");
			goto status1;
		}
		else if(choice!='y'&&choice!='Y'&&choice!='n'&&choice!='N')
		{
			cout<<"您键入的内容有误,请重新选择."<<endl;
			goto status2;
		}
	}
	else if(choice=='2')
	{
status3:
		cout<<"请输入要查找的学生的姓名:";
		cin>>Name;
		cout<<"请输入学生所在的班级:";
		cin>>Class;

		for(pGuard=head;pGuard!=NULL;pGuard=pGuard->next)
		{
			if(pGuard->Class==Class&&strcmp(pGuard->Name,Name)==0)
			{
				cout<<"找到该学生,已记录的信息如下:"<<endl;

				cout<<"		学生姓名:		"<<pGuard->Name <<endl;
		
				cout<<"		班级:			"<<pGuard->Class <<endl;
		
				cout<<"		学号:			"<<pGuard->Number <<endl;

				cout<<"		性别:			";
				if(pGuard->Sex==1)
					cout<<"男"<<endl;
				else
					cout<<"女"<<endl;
		
				cout<<"		年龄:			"<<pGuard->Age <<endl;
	
				cout<<"		宿舍号:			"<<pGuard->Room <<endl;

				cout<<"		电话号码:		"<<pGuard->Tel <<endl;

				return;
			}
		}
		cout<<"没有找到该学生的信息."<<endl;
status4:
		cout<<"要重新输入学生的班级和姓名吗?(y/n):";
		cin>>choice;
		if(choice=='y'||choice=='Y')
		{
			cout<<"那么请重新输入吧!"<<endl;
			system("pause");
			goto status3;
		}
		else if(choice!='y'&&choice!='Y'&&choice!='n'&&choice!='N')
		{
			cout<<"您键入的内容有误,请重新选择."<<endl;
			goto status4;
		}
	}
	else if(choice!='1'&&choice!='2')
	{
		cout<<"您键入的内容有错,请重新选择."<<endl;
		goto status0;
	}
}

void DisplayScore(Student* &head)
{
	Student *pGuard;

	for(pGuard=head;pGuard!=NULL;pGuard=pGuard->next)
	{
		cout<<"		学生姓名:		"<<pGuard->Name <<endl;
		
		cout<<"		班级:			"<<pGuard->Class <<endl;
		
		cout<<"		学号:			"<<pGuard->Number <<endl;

		cout<<"		微积分成绩:		"<<pGuard->Score [0]<<endl;
		
		cout<<"		物理成绩:		"<<pGuard->Score [1]<<endl;

		cout<<"		英语成绩:		"<<pGuard->Score [2]<<endl;

		cout<<"		C语言成绩:		"<<pGuard->Score [3]<<endl;

		cout<<"		体育成绩:		"<<pGuard->Score [4]<<endl;

		cout<<"     各科平均成绩:   "<<pGuard->Average<<endl<<endl<<endl;
	}
}

void DisplayOneScore(Student* &head)
{
	Student *pGuard;
	int Class,Number;
	char choice;
	char Name[20];

	cout<<"说明:本程序提供①根据学生的学号"
		<<"               ②根据学生姓名和所在的班级"
		<<"               两种方式来查找并显示学生的成绩."
		<<endl;
status0:
	cout<<"请选择查找方式(1/2): "<<endl;
	cin>>choice;
	
	if(choice=='1')
	{
status1:
		cout<<"请输入查找的学生的学号:"<<endl;
		cin>>Number;

		for(pGuard=head;pGuard!=NULL;pGuard=pGuard->next)
		{
			if(pGuard->Number==Number)
			{
				cout<<"找到该学生,已记录的成绩如下:"<<endl;

				cout<<"		学生姓名:		"<<pGuard->Name <<endl;
		
				cout<<"		班级:			"<<pGuard->Class <<endl;
		
				cout<<"		学号:			"<<pGuard->Number <<endl;

				cout<<"		微积分成绩:		"<<pGuard->Score [0]<<endl;
		
				cout<<"		物理成绩:		"<<pGuard->Score [1]<<endl;

				cout<<"		英语成绩:		"<<pGuard->Score [2]<<endl;

				cout<<"		C语言成绩:		"<<pGuard->Score [3]<<endl;

				cout<<"		体育成绩:		"<<pGuard->Score [4]<<endl;

				cout<<"     各科平均成绩:   "<<pGuard->Average<<endl;

				return;
			}
		}
		cout<<"没有找到该学生的信息."<<endl;
status2:
		cout<<"要重新输入学生的学号吗?(y/n):";
		cin>>choice;
		if(choice=='y'||choice=='Y')
		{
			cout<<"那么请重新输入吧!"<<endl;
			system("pause");
			goto status1;
		}
		else if(choice!='y'&&choice!='Y'&&choice!='n'&&choice!='N')
		{
			cout<<"您键入的内容有误,请重新选择."<<endl;
			goto status2;
		}
	}
	else if(choice=='2')
	{
status3:
		cout<<"请输入要查找的学生的姓名:";
		cin>>Name;
		cout<<"请输入学生所在的班级:";
		cin>>Class;

		for(pGuard=head;pGuard!=NULL;pGuard=pGuard->next)
		{
			if(pGuard->Class==Class&&strcmp(pGuard->Name,Name)==0)
			{
				cout<<"找到该学生,已记录的成绩如下:"<<endl;

				cout<<"		学生姓名:		"<<pGuard->Name <<endl;
		
				cout<<"		班级:			"<<pGuard->Class <<endl;
		
				cout<<"		学号:			"<<pGuard->Number <<endl;

				cout<<"		微积分成绩:		"<<pGuard->Score [0]<<endl;
		
				cout<<"		物理成绩:		"<<pGuard->Score [1]<<endl;

				cout<<"		英语成绩:		"<<pGuard->Score [2]<<endl;

				cout<<"		C语言成绩:		"<<pGuard->Score [3]<<endl;

				cout<<"		体育成绩:		"<<pGuard->Score [4]<<endl;

				cout<<"     各科平均成绩:   "<<pGuard->Average<<endl;

				return;
			}
		}
		cout<<"没有找到该学生的信息."<<endl;
status4:
		cout<<"要重新输入学生的班级和姓名吗?(y/n):";
		cin>>choice;
		if(choice=='y'||choice=='Y')
		{
			cout<<"那么请重新输入吧!"<<endl;
			system("pause");
			goto status3;
		}
		else if(choice!='y'&&choice!='Y'&&choice!='n'&&choice!='N')
		{
			cout<<"您键入的内容有误,请重新选择."<<endl;
			goto status4;
		}
	}
	else if(choice!='1'&&choice!='2')
	{
		cout<<"您键入的内容有错,请重新选择."<<endl;
		goto status0;
	}
}

void DisplayAllRank(Student* &head)
{
	Student *pGuard;
	int rank=0;

	cout<<"下面显示的是年级排名情况:"<<endl<<endl;;
	for(pGuard=head;pGuard!=NULL;pGuard=pGuard->next)
	{
		rank++;

		cout<<"第"<<rank<<"名:"<<endl;

		cout<<"		学生姓名:		"<<pGuard->Name <<endl;
		
		cout<<"		班级:			"<<pGuard->Class <<endl;
		
		cout<<"		学号:			"<<pGuard->Number <<endl;

		cout<<"		微积分成绩:		"<<pGuard->Score [0]<<endl;
		
		cout<<"		物理成绩:		"<<pGuard->Score [1]<<endl;

		cout<<"		英语成绩:		"<<pGuard->Score [2]<<endl;

		cout<<"		C语言成绩:		"<<pGuard->Score [3]<<endl;

		cout<<"		体育成绩:		"<<pGuard->Score [4]<<endl;

		cout<<"     各科平均成绩:   "<<pGuard->Average<<endl<<endl<<endl;
	}
}

void DisplayClassRank(Student* &head)
{
	Student *pGuard;
	Student *p;
	int rank=0;

	cout<<"下面显示的是各班内部排名情况:"<<endl<<endl;
	for(p=pGuard=head;pGuard!=NULL;pGuard=pGuard->next)
	{
		if(pGuard->Class!=p->Class)
		{
			rank=0;
		}

		rank++;

		cout<<pGuard->Class<<"班第"<<rank<<"名"<<endl;

		cout<<"		学生姓名:		"<<pGuard->Name <<endl;
		
		cout<<"		班级:			"<<pGuard->Class <<endl;
		
		cout<<"		学号:			"<<pGuard->Number <<endl;

		cout<<"		微积分成绩:		"<<pGuard->Score [0]<<endl;
		
		cout<<"		物理成绩:		"<<pGuard->Score [1]<<endl;

		cout<<"		英语成绩:		"<<pGuard->Score [2]<<endl;

		cout<<"		C语言成绩:		"<<pGuard->Score [3]<<endl;

		cout<<"		体育成绩:		"<<pGuard->Score [4]<<endl;

		cout<<"     各科平均成绩:   "<<pGuard->Average<<endl<<endl<<endl;

		p=pGuard;
	}
}

void DisplayCopyright()
{
	cout<<endl<<endl<<endl
		<<"    WARNING:"<<endl
		<<"            This program is built by QinTao,Computer Department of"<<endl
		<<"            Huazhong University of Science and Technology(HUST)."<<endl
		<<"            And this computer program is protected by copyright "<<endl
		<<"            and international treaties.Unauthorized reproduction"<<endl
		<<"            or distribution of this program,or any portion of it,"<<endl
		<<"            may result in severe civil and criminal penalties,and"<<endl
		<<"            will be prosecuted to the maximum extent possible un-"<<endl
		<<"            der the law."<<endl
		<<"            But of course,would you believe this simple program,"<<endl
		<<"            based on the Win32 Console Application,can make any "<<endl
		<<"            commercial profits? Absolutely not! So the saying above"<<endl
		<<"            is just in jest,making the program like a real one."<<endl
		<<"            Think nothing of it,just use it freely as long as you"<<endl
		<<"            enjoy it."<<endl
		<<"                                                       Jun,2003"
		<<endl<<endl<<endl;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -