研究生初试系统_面向对象程序设计c++

(俺滴面向对象99,芜湖感动)

研究生初试系统

1基本要求:

研究生考试课程为4门,其中数学、外语、政治为统一命题,而专业基础课则根据不同的专业由招生学校自行命题。国家对初试录取分数有总分要求(如某一年要求4门课总分应达到310分),另外还有对每门课的最低分数要求(如总分为100的试卷最低应达到40分,总分为150的试卷最低应达到65分)。

2功能要求:

1、设计菜单实现功能选择;
2、能够新增、修改和删除学生的信息,包括:考生姓名,准考证号,报考专业,是否应届生,4门课程(政治、数学、外语、专业基础课)成绩;
3、能统计初试合格的人数,并按总分由高到低的顺序输出合格考生的信息。
4、程序运行时首先要求将考生信息这些原始数据应保存到一个文件中;然后输入:录取的总分要求,各课程的最低分数要求;输出要求:过线考生的姓名,准考证号,报考专业,是否应届生,4门课程(政治、数学、外语、专业基础课)成绩及总分,这些信息应存放到另一个文件中。

3代码实现

3.1代码思想(流程图)

3.2代码展示

注:该系统实现基于Visual Studio 2019版本

代码如下
Min_score.h

//Min_score.h

#ifndef  __SOMEFILE_H__
#define  __SOMEFILE_H__
//避免同一个头文件被包含include多次
//或者使用#pragma once,略有不同

#include <iostream>
using namespace std;

//录取总分及各科最低分数线
class Min_score 
{
public:
	//带默认参数的构造函数
	Min_score(int su1 = 310, int po1 = 60, int ma1 = 80, int en1 = 60, int spl = 80) {
		sum_line = su1;
		politics_line = po1;
		math_line = ma1;
		english_line = en1;
		specialized_line = spl;
	}
	~Min_score(){}//析构函数
	
	//输入函数
	void input(int su1, int po1, int ma1, int en1, int cu1) {
		sum_line = su1;
		politics_line = po1;
		math_line = ma1;
		english_line = en1;
		specialized_line = cu1;
	}

	//定义student类为Min_score类的友元
	friend class student;

private:
	//总分100的试卷最低应达到40分,总分150的试卷最低应达到65
	int sum_line;//总分数线
	int politics_line;//政治分数线
	int math_line;//数学分数线
	int english_line;//英语分数线
	int specialized_line;//专业基础课分数线
};

#endif

students.h

// students.h

#pragma once//避免同一个头文件被include多次
#include <iostream>
#include <string>
#include <fstream>//处理文件,包含open()close()
#include <iomanip>//使用I/O流类库中操作子,实现格式化输入输出
#include "Min_score.h"
using namespace std;

//基类,保存person的姓名,性别,年龄
class person 
{
public:
	//带默认参数构造函数
	person(string name0 = " ", string sex0 = " ", int age0 = 18) 
	{
		name = name0;
		sex = sex0;
		age = age0;
	}
	~person(){}//析构函数

protected:
	string name;//姓名
	string sex;//性别
	int age;//年龄
};

//派生类,公有继承person类
class student :public person 
{
public:
	//不含参数的构造函数
	student()
	{
		major = "飞行器设计与工程";
		id = 0001;
		current = "是";
		polity = 80;
		math = 80;
		english = 80;
		specialized = 80;
	}
	//含参数的构造函数
	student(string name1, string sex1, int age1, string major1, string id1, string current1, 
		int polity1, int math1,int english1,int specialized1) :person(name1, sex1, age1) 
	{
		major = major1;
		id = id1;
		current = current1;
		polity = polity1;
		math = math1;
		english = english1;
		specialized = specialized1;
	}
	//析构函数
	~student() {};

	//输入类成员信息
	void input(string name1, string sex1, int age1, string major1, string id1, 
		string current1, int polity1, int math1, int english1, int specialized1);
	
	//更改类成员的部分信息
	void change_name(string name1) { name = name1; }
	void change_sex() { (sex == "男")?(sex = "女"):(sex = "男"); }
	void change_age(int age1) { age = age1; }
	void change_major(string major1) { major = major1; }
	void change_current() { (current == "是") ? (current = "否") : (current = "是"); }
	void change_score(int polity1, int math1, int english1, int specialized1)
	{
		polity = polity1;
		math = math1;
		english = english1;
		specialized = specialized1;
	}

	//计算总成绩
	int Sum() 
	{
		int result;
		result = polity + math + english + specialized;
		return result;
	}

	//判断是否过线(大于最低分数线),过线返回1,否则返回0
	int ifpass(Min_score& obj);

	//写入文件,保存所有考生的信息(三个文件,全部考生/过线考生/未过线考生)
	void intofile1();
	void intofile2();
	void intofile3();

	//友元函数重载插入符“<<”
	friend ostream& operator << (ostream& stream, student& p) 
	{
		stream << "姓名:" << p.name << "\t性别:" << p.sex << "\t年龄:" << p.age << "\t专业:" << p.major 
			<< "\t考号:" << p.id << "\t是否应届:" << p.current << "\n政治:" << p.polity << "\t数学:" << p.math 
			<< "\t英语:" << p.english << "\t专业课:" << p.specialized << "\t总成绩:" << p.Sum() << endl;
		return stream;
	}

	//获取私有成员
	int Getp() {return polity;}
	int Getm() {return math;}
	int Gete() {return english;}
	int Gets() {return specialized;}
	string Getid() {return id;}
	
	//根据总成绩对考生进行排序
	friend void rank_sum(student arr[], int m);

protected:
	string major;//专业
	string id;//准考证号
	string current;//是否为应届生
	int polity;//政治成绩
	int math;//数学成绩
	int english;//英语成绩
	int specialized;//专业基础课成绩
};


//输入类成员信息
void student::input(string name1, string sex1, int age1, string major1, string id1, 
	string current1, int polity1, int math1, int english1, int specialized1)
{
	name = name1;
	sex = sex1;
	age = age1;
	major = major1;
	id = id1;
	current = current1;
	polity = polity1;
	math = math1;
	english = english1;
	specialized = specialized1;
}

//判断成绩是否过线,过线返回1,否则返回0
int student::ifpass(Min_score& obj)
{
	int flag = 0;//判断是否过线,1-过线,0-未过
	if (Sum() >= obj.sum_line && polity >= obj.politics_line && math >= obj.math_line
		&& english >= obj.english_line && specialized >= obj.specialized_line) 
		flag = 1;
	return flag;
}

//将类成员写入text1,所有考生信息
void student::intofile1() {
	ofstream out;//文件输出流对象,用于写文件
	out.open("text1.txt", ios::app);//打开文件,每次写入前寻位到流结尾
	out << name;
	out << "\t";//水平制表符
	out << sex;
	out << "\t";
	out << age;
	out << "\t";
	out << major;
	out << "\t";
	out << id;
	out << "\t";
	out << current;
	out << "\t";
	out << polity;
	out << "\t";
	out << math;
	out << "\t";
	out << english;
	out << "\t";
	out << specialized << setw(9);//设置域宽
	out.close();
}

//将类成员写入text2,过线考生信息
void student::intofile2() 
{
	ofstream out;//文件输出流对象,用于写文件
	out.open("text2.txt", ios::app);//打开文件,每次写入前寻位到流结尾
	out << name;
	out << "\t";//水平制表符
	out << sex;
	out << "\t";
	out << age;
	out << "\t";
	out << major;
	out << "\t";
	out << id;
	out << "\t";
	out << current;
	out << "\t";
	out << polity;
	out << "\t";
	out << math;
	out << "\t";
	out << english;
	out << "\t";
	out << specialized << setw(9);//设置域宽
	out.close();
}

//将类成员写入text3,未过线考生信息
void student::intofile3() 
{
	ofstream out;//文件输出流对象,用于写文件
	out.open("text3.txt", ios::app);//打开文件,每次写入前寻位到流结尾
	out << name;
	out << "\t";//水平制表符
	out << sex;
	out << "\t";
	out << age;
	out << "\t";
	out << major;
	out << "\t";
	out << id;
	out << "\t";
	out << current;
	out << "\t";
	out << polity;
	out << "\t";
	out << math;
	out << "\t";
	out << english;
	out << "\t";
	out << specialized << setw(9);//设置域宽
	out.close();
}

//按总成绩由高到低排序
void rank_sum(student arr[], int m)
{
	int i = 0, j = 0;//for循环控制变量
	student tmp;
	for (i = 0; i < m; i++)
	{
		for (j = i + 1; j < m; j++)
		{
			if (arr[i].Sum() < arr[j].Sum())
			{
				tmp = arr[i];
				arr[i] = arr[j];
				arr[j] = tmp;
			}
		}
	}
}

main.cpp

//main.cpp

#include <iostream>
#include <fstream>//包含open()close()
#include <string>
#include <cstdlib>
#include "Min_score.h"
#include "students.h"
using namespace std;

//判断文件text1是否为空
int empty1()
{
	char ch;//取文件中字符
	ifstream ifs("text1.txt", ios::in);
	ifs >> ch;
	int flag = 1;//函数返回值,0-文件空
	if (ifs.eof())
		flag = 0;
	ifs.close();
	return flag;
}
//判断文件text2是否为空
int empty2()
{
	char ch;//取文件中字符
	ifstream ifs("text2.txt", ios::in);
	ifs >> ch;
	int flag = 1;//函数返回值,0-文件空
	if (ifs.eof())
		flag = 0;
	ifs.close();
	return flag;
}
//判断文件text3是否为空
int empty3()
{
	char ch;//取文件中字符
	ifstream ifs("text3.txt", ios::in);
	ifs >> ch;
	int flag = 1;//函数返回值,0-文件空
	if (ifs.eof())
		flag = 0;
	ifs.close();
	return flag;
}

//录入考生信息
void Add_stu()
{
	string name;//姓名
	string sex;//性别
	int age;//年龄
	string major;//专业
	string id;//准考证号
	string current;//是否为应届生
	int polity;//政治成绩
	int math;//数学成绩
	int english;//英语成绩
	int curscore;//专业基础课成绩
	string flag;//判断循环是否继续
	int i = 0;//数组序号
	//申请内存空间
	student* network;
	network = new student[20];
	while (1) {
		cout << "您正在输入第 " << i + 1 << " 位学生信息\n" << endl;
		cout << "姓名 " << "性别 " << "年龄 " << "报考专业 " << "准考证号 " 
			<< "是否应届生 "<< "政治 " << "数学 " << "英语 " << "专业基础课" << endl;
		cin >> name >> sex >> age >> major >> id >> current >> polity >> math >> english >> curscore;
		cout << endl;
		if (polity >= 0 && polity <= 100 && english >= 0 && english <= 100 && curscore >= 0 && curscore <= 150 && math >= 0 && math <= 150)
		{
			//输入数据
			network[i].input(name, sex, age, major, id, current, polity, math, english, curscore);

			//写入文件
			network[i].intofile1();
			i++;

			//控制循环是否继续
			cout << "是否继续? 是/否: ";
			cin >> flag;
			if (flag == "否")
			{
				system("cls");//清屏
				break;
			}
		}
		else
		{
			cout << "*******  输入的成绩有误,请重新输入  *******" << endl;
			cout << "提示:英语、政治0-100,数学、专业基础课0-150" << endl;
		}
		cout << endl;
	}
	delete[] network;//删除new创建的对象数组
}

//输入成绩分数线要求
void Get_line(Min_score min)
{
	//从参数中获取分数线要求,为Min_score类对象
	Min_score R = min;

	string name;//姓名
	string sex;//性别
	int age;//年龄
	string major;//专业
	string id;//准考证号
	string current;//是否为应届生
	int polity;//政治成绩
	int math;//数学成绩
	int english;//英语成绩
	int curscore;//专业基础课成绩
	student stu;//创建student类对象,用于循环保存信息
	
	ofstream de1("text2.txt", ios::trunc);//如果文件存在,清空文件内容
	de1.close();
	ofstream de2("text3.txt", ios::trunc);//如果文件存在,清空文件内容
	de2.close();
	ifstream is("text1.txt", ios::in | ios::binary);
	while (!is.eof()) {
		is >> name>> sex>> age>> major>> id>> current>> polity>> math>> english>> curscore;
		stu.input(name, sex, age, major, id, current, polity, math, english, curscore);
		if (stu.ifpass(R))
		{
			stu.intofile2();//将过线学生保存到“text2.txt”
		}
		else 
		{
			stu.intofile3();//将未过线学生保存到“text3.txt”
		}
	}
	is.close();
}

//按总分排序查看当前考生信息
void Sort_stu(int num) 
{
	string name;//姓名
	string sex;//性别
	int age;//年龄
	string major;//专业
	string id;//准考证号
	string current;//是否为应届生
	int polity;//政治成绩
	int math;//数学成绩
	int english;//英语成绩
	int curscore;//专业基础课成绩
	int i = 0;//数组序号
	student* stu;//申请内存空间
	stu = new student[20];

	int num1 = num;//判断输出text1,2,3文件信息
	int flag = 0;//判断是否为空文件标志
	if (num1 == 1&&empty1())
	{
		ifstream in("text1.txt", ios::in);//为读打开
		while (!in.eof())
		{
			in >> name >> sex >> age >> major >> id >> current >> polity >> math>> english >> curscore;
			stu[i].input(name, sex, age, major, id, current, polity, math, english, curscore);
			i += 1;
		}
		in.close();
		flag = 1;
	}
	if (num1 == 2&&empty2())
	{
		ifstream in("text2.txt", ios::in);//为读打开
		while (!in.eof())
		{
			in >> name >> sex >> age >> major >> id >> current >> polity >> math >> english >> curscore;
			stu[i].input(name, sex, age, major, id, current, polity, math, english, curscore);
			i += 1;
		}
		in.close();
		flag = 1;
	}
	if (num1 == 3&&empty3())
	{
		ifstream in("text3.txt", ios::in);//为读打开
		while (!in.eof()) 
		{
			in >> name >> sex >> age >> major >> id >> current >> polity >> math >> english >> curscore;
			stu[i].input(name, sex, age, major, id, current, polity, math, english, curscore);
			i += 1;
		}
		in.close();
		flag = 1;
	}
	
	if (flag)
	{
		rank_sum(stu, i);//排序
		cout << endl;
		cout << "以下考生数量为 " << i << " 人"<< endl;
		cout << endl;
		for (int k = 0; k < i; k++)
		{
			cout << stu[k] << endl;//输出到屏幕
		}
	}
	else
	{
		cout << endl;
		cout << "无考生信息" << endl;
	}
	
	delete[] stu;
}

//删除考生信息
void Delete_stu()
{
	string name;//姓名
	string sex;//性别
	int age;//年龄
	string major;//专业
	string id;//准考证号
	string current;//是否为应届生
	int polity;//政治成绩
	int math;//数学成绩
	int english;//英语成绩
	int curscore;//专业基础课成绩
	int i = 0;//数组序号
	student* stu;//申请内存空间
	stu = new student[20];

	ifstream in("text1.txt", ios::in | ios::binary);
	while (!in.eof())
	{
		in >> name >> sex >> age >> major >> id >> current >> polity >> math >> english >> curscore;
		stu[i].input(name, sex, age, major, id, current, polity, math, english, curscore);
		i += 1;
	}
	cout << "请输入您需要要删除考生的准考证号:" ;
	string id_delete;//要输入的删除考生考号
	cin >> id_delete;
	int flag = 0;//遍历数组,判断是否存在该考生,1-存在,0-不存在
	int k = 0;//确定删除考生的数组序号
	for (int j = 0; j < i; j++)
	{
		if (id_delete == stu[j].Getid())
		{
			flag = 1;
			k = j;
		}
	}
	if (!flag)
	{
		cout << "抱歉输入错误,没有与之对应的考生" << endl;
		in.close();
	}
	else
	{
		system("cls");
		cout << "查询到准考证号为" << stu[k].Getid() << "的信息如下:" << endl;
		cout << stu[k];
		cout << endl;
		cout << "确认要删除该考生信息?是/否:";
		string choice;//确认是否删除考生
		cin >> choice;
		if (choice == "是")
		{
			for (int m = k; m < i; m++)
				stu[m] = stu[m + 1];
			i -= 1;
			cout << endl;
			cout << "******** 删除成功 ********" << endl;
		}
		in.close();
		ofstream de2("text1.txt", ios::trunc);//如果文件存在,清空文件内容
		de2.close();
		for (int k = 0; k < i; k++)
			stu[k].intofile1();
	}
	delete[] stu;
}

//修改考生信息
void Change_stu() {
	string name;//姓名
	string sex;//性别
	int age;//年龄
	string major;//专业
	string id;//准考证号
	string current;//是否为应届生
	int polity;//政治成绩
	int math;//数学成绩
	int english;//英语成绩
	int curscore;//专业基础课成绩
	int i = 0;//数组序号
	student* stu;//申请内存空间
	stu = new student[20];

	ifstream in("text1.txt", ios::in|ios::binary );
	while (!in.eof())
	{
		in >> name >> sex >> age >> major >> id >> current >> polity >> math >> english >> curscore;
		stu[i].input(name, sex, age, major, id, current, polity, math, english, curscore);
		i += 1;
	}
	cout << "请输入要修改的考生的准考证号:" ;
	string id_change;
	int flag = 0;//遍历数组,判断是否存在该考生,1-存在,0-不存在
	int k = 0;//确定要修改考生的数组序号
	cin >> id_change;
	for (int j=0;j<i;j++)
	{
		if (id_change == stu[j].Getid())
		{
			flag = 1;
			k = j;
		}
	}

	if (!flag)
	{
		cout << "抱歉输入错误,没有与之对应的考生" << endl;
	}
	else
	{
		int flag1 = 0;//控制do while循环次数
		int choice0;//修改考生信息的选项,0-6
		do {
			system("cls");
			cout << "查询到准考证号为" << stu[k].Getid() << "的信息如下:" << endl;
			cout << stu[k];
			cout << endl;
			cout << "*******  修改考生信息  *******" << endl;
			cout << endl;
			cout << "\t1.修改姓名" << endl;
			cout << endl;
			cout << "\t2.修改性别" << endl;
			cout << endl;
			cout << "\t3.修改专业" << endl;
			cout << endl;
			cout << "\t4.修改年龄" << endl;
			cout << endl;
			cout << "\t5.修改成绩" << endl;
			cout << endl;
			cout << "\t6.修改应届生情况" << endl;
			cout << endl;
			cout << "\t0.返回上级菜单" << endl;
			cout << endl;
			cout << "******************************"<<endl;
			cout << endl;
			cout << "修改该考生信息,请输入0-6:" ;
			cin >> choice0;
			switch (choice0)
			{
			case 1:
				cout << "请输入修改后的名字:";
				cin >> name;
				stu[k].change_name(name);
				cout << endl;
				cout << "********** 修改成功 **********" << endl;
				break;
			case 2:
				stu[k].change_sex();
				cout << endl;
				cout << "********** 修改成功 **********" << endl;
				break;
			case 3:
				cout << "请输入修改后的专业:" ;
				cin >> major;
				stu[k].change_major(major);
				cout << endl;
				cout << "********** 修改成功 **********" << endl;
				break;
			case 4:
				cout << "请输入修改后的年龄:";
				cin >> age;
				stu[k].change_age(age);
				cout << endl;
				cout << "********** 修改成功 **********" << endl;
				break;
			case 5:
				cout << "请输入修改后的政治,数学,英语,专业基础课成绩:" ;
				cin >> polity >> math >> english >> curscore;
				stu[k].change_score(polity, math, english, curscore);
				cout << endl;
				cout << "********** 修改成功 **********" << endl;
				break;
			case 6:
				stu[k].change_current();
				cout << endl;
				cout << "********** 修改成功 **********" << endl;
				break;
			case 0:
				goto break1;
			default:
				break;
			}
			cout << endl;
			cout << "修改后的信息为:" << endl;
			cout << stu[k];
			cout << "是否返回上一级(0-返回,1-继续修改该考生信息)" << endl;
			cin >> flag1;
		} while (flag1);
break1:
		system("cls");
		in.close();
		ofstream de2("text1.txt", ios::trunc);//如果文件存在,清空文件内容
		de2.close();
		for (int k=0;k<i;k++)
			stu[k].intofile1();
	}
	delete[] stu;
}

int main() 
{
	Min_score score_line;//最低分数线,Min_score类对象
	int sum;//总成绩
	int polity;//政治成绩
	int math;//数学成绩
	int english;//英语成绩
	int curscore;//专业基础课成绩
breakhere1:
breakhere2:
	int choice1 = 0;//菜单选项
	int	choice2;//控制do while循环
	do {
		cout << endl;
		cout << "****欢迎使用研究生初试录取系统****" << endl;
		cout << endl;
		cout << "\t请选择所需功能:" << endl;
		cout << endl;
		cout << "\t1.增加考生信息" << endl;
		cout << endl;
		cout << "\t2.输入分数线要求" << endl;
		cout << endl;
		cout << "\t3.排序输出考生信息" << endl;
		cout << endl;
		cout << "\t4.删除考生信息" << endl;
		cout << endl;
		cout << "\t5.修改考生信息" << endl;
		cout << endl;
		cout << "\t0.退出系统" << endl;
		cout << endl;
		cout << "**********************************" << endl;
		cout << "\n请您输入0-5:";
		cin >> choice1;
		switch (choice1) 
		{
		case 1:
			system("cls");
			Add_stu();//输入学生初始信息
			Get_line(score_line);//更新分数线,重新划分出线考生
			cout << endl;
			cout << "*** 返回上级菜单请按 0 ***" << endl;
			cout << "\n请您输入:";
			cin >> choice2;
			system("cls");
			break;
		case 2:
			system("cls");
			cout << "请输入:总成绩,政治,数学,英语,专业基础课的标准:\n";
			cin >> sum >> polity >> math >> english >> curscore;
			score_line.input(sum, polity, math, english, curscore);//输入分数线
			Get_line(score_line);//更新分数线,重新划分出线考生
			cout << endl;
			cout << "*** 返回上级菜单请按 0 ***" << endl;
			cout << "\n请您输入:";
			cin >> choice2;
			system("cls");
			break;
		case 3:
			system("cls");
			int choice3;//菜单选项0-3
			int	flag3;//控制do while循环
			do 
			{
				system("cls");
				cout << "*****  按总分排序输出考生信息  *****" << endl;
				cout << endl;
				cout << "\t1.所有考生信息" << endl;
				cout << endl;
				cout << "\t2.过线考生信息" << endl;
				cout << endl;
				cout << "\t3.未过线考生信息" << endl;
				cout << endl;
				cout << "\t0.返回上级菜单" << endl;
				cout << endl;
				cout << "************************************" << endl;
				cout << "\n请您输入0-3:";
				cin >> choice3;
				switch (choice3)
				{
				case 1:
					Sort_stu(1);
					break;
				case 2:
					Get_line(score_line);//更新分数线
					Sort_stu(2);
					break;
				case 3:
					Get_line(score_line);//更新分数线
					Sort_stu(3);
					break;
				case 0:
					system("cls");
					goto breakhere2;
				default:
					break;
				}
				cout << endl;
				cout << "*** 返回上级菜单请按 0 ***" << endl;
				cout << "\n请您输入:";
				cin >> flag3;
			} while (!flag3);
			cout << endl;
			cout << "*** 返回上级菜单请按 0 ***" << endl;
			cout << "\n请您输入:";
			cin >> choice2;
			system("cls");
			break;
		case 4://删除考生信息
			Delete_stu();
			Get_line(score_line);//根据删除后的考生信息重新划分出线学生
			cout << endl;
			cout << "*** 返回上级菜单请按 0 ***" << endl;
			cout << "\n请您输入:";
			cin >> choice2;
			system("cls");
			break;
		case 5:
			Change_stu();//修改考生信息
			Get_line(score_line);//根据修改后的考生信息重新划分出线学生
			cout << endl;
			cout << "*** 返回上级菜单请按 0 ***" << endl;
			cout << "\n请您输入:";
			cin >> choice2;
			system("cls");
			break;
		case 0:
			cout << endl;
			cout << "*********  系统成功退出  *********" << endl;
			choice2 = 1;
			break;
		default:
			break;
		}
	} while (!choice2);
	return 0;
}
3.3 系统效果展示

在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述在这里插入图片描述
以上图片仅展示了部分功能,其他的功能可以参考流程图中所展示的,或者运行代码自己感受嘿嘿。

4小结

这是本人选修课面向对象程序设计的一个大作业,感谢老师的仁慈,最终赐我99,祝老师每周一篇顶刊,呜呜!!!
最开始无处下手,也是查阅了参考书以及借鉴网上的资料,好几天修修改改,并经过计算机专业同学最后一步检验,得到了肯定。总的来说非常印象深刻的一次大作业,感谢每个帮助我的小伙伴,希望能给大家带来一点点的参考和帮助!

5参考资料,非常感谢!!

参考书
《C++语言基础教程》(第三版) 吕凤翥

参考文章
blog链接: C++课程设计:研究生初试录取程序.

相较于这篇blog,我的程序中主要是在增加、删除、修改考生信息这块进一步完善,并且优化了其他方面,特别感谢这篇blog给我提供的巨大帮助!!!

  • 4
    点赞
  • 28
    收藏
    觉得还不错? 一键收藏
  • 2
    评论
研究生考试课程为4门,其中数学、外语、政治为统一命题,而专业基础课则根据不同的专业由招生学校自行命题。国家对初试录取分数有总分要求(如某一年要求4门课总分应达到310分),另外还有对每门课的最低分数要求(如总分为100的试卷最低应达到40分,总分为150的试卷最低应达到65分)。编程统计初试合格的人数,并按总分由高到低的顺序输出合格考生的信息。 基本要求:程序运行时首先要求输入:考生姓名,准考证号,报考专业,是否应届生,4门课程(政治、数学、外语、专业基础课)成绩。这些原始数据应保存到一个文件中。然后输入:录取的总分要求,各课程的最低分数要求。输出要求:过线考生的姓名,准考证号,报考专业,是否应届生,4门课程(政治、数学、外语、专业基础课)成绩及总分,这些信息应存放到另一个文件中。 测试数据:程序应输入不少于10名考生的信息,其中应届生和历届生分别有若干名,并且都有合格和不合格的情况。 实现提示:可定义一个考生类存放有关信息和实现相应的操作。分数线数据(总分要求和各门课程的要求)可定义另外的类来存放,但应能被考生类及其派生类直接访问。 其它要求:初试合格的考生应经过复试才能决定是否录取,复试成绩合格(大于一给定分值)可以录取,否则被淘汰。而录取的顺序假设是按照专业基础课和复试成绩的平均值来确定的(因为这涉及到是计划内还是委培问题)。因此,应首先输入初试合格考生的复试成绩及复试的合格线分数,然后按上面要求排序输出并标明被淘汰的学生。
评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值