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

📄 student.cpp

📁 我用二叉搜索树做的学生成绩管理系统
💻 CPP
字号:
#include "Student.h"

Student::Student()
{
	no=0;
	String name;
	String sex;
	score=0;
}

Student::Student(long & No,String & Name,String & Sex,long & Score)
{
	no=No;
	name=Name;
	sex=Sex;
	score=Score;
}

Student::Student(const Student & S)
{
	if(this!=&S)
	{
		no=S.no;
		name=S.name;
		sex=S.sex;
		score=S.score;
	}
}

Student & Student::operator =(Student & S)
{
	if(this!=&S)
	{
		no=S.no;
		name=S.name;
		sex=S.sex;
		score=S.score;
	}
	return *this;
}

istream & operator>>(istream & is,Student & S)
{
	cout<<"Input number:"<<endl;
	cout<<"\t";
	is>>S.no;
	if(S.no==0)
	{
		S.name=" ";
		S.sex=" ";
		S.score=0;
		return is;
	}
	else
	{
		cout<<"\tInput name:"<<endl;
		cout<<"\t";
		is>>S.name;
		cout<<"\tInput sex:('m'or'f'):"<<endl;
		cout<<"\t";
		is>>S.sex;
		cout<<"\tInput score:"<<endl;
		cout<<"\t";
		is>>S.score;
		return is;
	}
}

ifstream & operator>>(ifstream & in,Student & S)
{
	in>>S.no;	
	in>>S.name;
	in>>S.sex;
	in>>S.score;
	return in;
}
ostream & operator<<(ostream & os,Student & S)
{
	os<<'\t'<<S.no<<'\t'<<S.name<<'\t'<<S.sex<<'\t'
		<<S.score<<endl;
	return os;
}

⌨️ 快捷键说明

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