/*
**
** *************《C++学生成绩管理系统》*********************
** ***某知名大学 — 信息工程学院 — 软件工程 — 梁 "可爱"***
** *******************2019-1-6******************************
**
*/
#include
#include
#include
#include "student.cpp"
#define Max 200
struct Student{
student stu[Max];
int length;
};
Student s;
using namespace std;
void Select_choose();//查询界面选择函数
void Select_show();//查询界面
void Main_show();//主界面
void choose();//主界面选择函数
void Add_show();//添加界面
void Add_choose();//添加界面选择函数
void add();//添加函数
void Select_information();//查询学生信息
void Select_score();//查询学生分数
void Update_show();//修改界面
void Updeta_choose();//修改界面选择函数
void Update();//修改信息函数
void Remove_show();//删除界面
void Remove_choose();//删除界面选择函数
void Remove();//删除函数
void Remove(){
system("cls");
if(s.length == 0){//判断是否有学生
cout<<"该系统内无学生信息!"<= 5){
system("cls");
cout<<"您已经输入失败"<>sno;
count++;
for(int i = 0;i < s.length;i++){//遍历数组,找到该学号学生信息
if(s.stu[i].getSno() == sno){
t = i;
break;
}
}
if(t == -1){//数组内没有该学号
if(count < 5){
cout<<"没有该学生的信息,请重新输入:";
}
continue;
}
else{
cout<<"是否要删除该学生("<>c;
if(c == 'N' || c == 'n'){
system("cls");
Remove_show();
}
else if(c == 'Y' || c == 'y'){
if(t == s.length - 1){
s.length--;
}
else{
s.stu[t].copy(s.stu[s.length -1]);
s.length--;
}
cout<<"删除成功!"<>d;
if(d == 'Y' || d == 'y'){
Remove();
}
else if(d == 'N' || d == 'n'){
system("cls");//清屏函数
Main_show();
}
else{
cout<<"输入非法!请重新输入:";
}
}
}
else{
cout<<"输入非法!请重新输入:";
}
}
}
}
}
void Remove_choose(){
int k;
cin>>k;
switch(k){
case 1:
system("cls");
Remove();
break;
case 2:
system("cls");
Main_show();
break;
case 0:
exit(0);
default:
cout<<"输入非法,请重新输入:";
Remove_choose();
}
}
void Remove_show(){
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<>sno;
count++;
if(count >= 5){
system("cls");
cout<<"您已经输入失败"<>name>>sex>>age>>math>>english>>computer;
cout<<"是否要修改该学生("<>c;
if(c == 'Y' || c == 'y'){
s.stu[t].setName(name);
s.stu[t].setSex(sex);
s.stu[t].setAge(age);
s.stu[t].setMath(math);
s.stu[t].setEnglish(english);
s.stu[t].setComputer(computer);
break;
}
else if(c == 'N' || c == 'n'){
break;
}
else{
cout<<"输入非法,请重新输入:";
}
}
cout<<"是否继续修改学生信息:(Y or N)";
char d;
while(true){
cin>>d;
if(d == 'Y' || d == 'y'){
system("cls");
Update();
}
else if(d == 'N' || d == 'n'){
system("cls");
Main_show();
}
else{
cout<<"输入非法,请重新输入:";
}
}
}
}
}
void Update_choose(){
int k;
cin>>k;
switch(k){
case 1:
system("cls");
Update();
break;
case 2:
system("cls");
Main_show();
break;
case 0:
exit(0);
default:
cout<<"输入非法,请重新输入:";
Update_choose();
}
}
void Update_show(){
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<>c;
while(1){
system("cls");
Select_show();
}
}
void Select_score(){
double sum1 = 0,sum2 = 0,sum3 = 0;
cout<<"学号\t姓名\t数学\t英语\t计算机\t总分\n";
for(int i = 0;i < s.length;i++){
cout<>c;
while(1){
system("cls");
Select_show();
}
}
void add(){
bool flag = false;
system("cls");
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<>sno;
for(int i = 0; i < s.length;i++){
if(s.stu[i].getSno() == sno)
flag = true;
}
if(flag){
flag = false;
cout<<"该学号已存在!"<>name;
s.stu[s.length].setName(name);
cout<<"请输入性别";
string sex;
cin>>sex;
s.stu[s.length].setSex(sex);
cout<<"请输入年龄:";
int age;
cin>>age;
s.stu[s.length].setAge(age);
cout<<"请输入数学成绩:";
double math;
cin>>math;
s.stu[s.length].setMath(math);
cout<<"请输入英语成绩:";
double english;
cin>>english;
s.stu[s.length].setEnglish(english);
cout<<"请输入计算机成绩:";
double computer;
cin>>computer;
s.stu[s.length].setComputer(computer);
system("cls");
cout<<"学号("<>t;
if(t == 'Y' || t == 'y'){
s.length++;
cout<<"您要继续添加吗?(Y or N)"<>temp;
if(temp == 'Y' || temp == 'y'){
system("cls");
add();
}
else if(temp == 'N' || temp == 'n'){
system("cls");
Main_show();
}
else{
cout<<"输入非法,请重新输入:";
}
}
while(true);
}
else if(t == 'N' || t == 'n'){
system("cls");
Add_show();
}
else{
cout<<"输入非法,请重新输入:";
}
}
while(true);
}
void Add_choose(){
int k;
cin>>k;
switch(k){
case 1:
add();
break;
case 2:
system("cls");
Main_show();
break;
case 0:
exit(0);
default:
cout<<"输入非法!请重新输入:";
Add_choose();
}
}
void Add_show(){
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<>k;
switch(k){
case 1:
system("cls");
Select_information();
break;
case 2:
system("cls");
Select_score();
break;
case 3:
system("cls");
Main_show();
break;
case 0:
exit(0);
default:
cout<<"输入非法!请重新输入:";
Select_choose();
}
}
void Select_show(){
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<>k;
switch(k){
case 1:
//查询界面
system("cls");
Select_show();
break;
case 2:
//添加界面
system("cls");
Add_show();
break;
case 3:
//修改界面
system("cls");
Update_show();
break;
case 4:
//删除界面
system("cls");
Remove_show();
break;
case 0:
exit(0);
default:
cout<<"输入非法!请重新输入:";
choose();
}
}
void Main_show(){
cout<<"~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"<
/*
学生类
*/
#include
#include
using namespace std;
class student
{
private:
int sno;//学号
string name;//姓名
string sex;//性别
int age;//年龄
double math;//数学
double english;//英语
double computer;//计算机
public:
void copy(student t){//
this->sno = t.getSno();
this->name = t.getName();
this->sex = t.getSex();
this->age = t.getAge();
this->math = t.getMath();
this->english = t.getEnglish();
this->computer = t.getComputer();
}
/* set() 和 get() */
void setSno(int sno)
{
this->sno = sno;
}
void setName(string name)
{
this->name = name;
}
void setSex(string sex)
{
this->sex = sex;
}
void setAge(int age)
{
this->age = age;
}
void setMath(double math)
{
this->math = math;
}
void setEnglish(double english)
{
this->english = english;
}
void setComputer(double computer)
{
this->computer = computer;
}
int getSno()
{
return this->sno;
}
string getName()
{
return this->name;
}
string getSex()
{
return this->sex;
}
int getAge()
{
return this->age;
}
double getMath()
{
return this->math;
}
double getEnglish()
{
return this->english;
}
double getComputer()
{
return this->computer;
}
void show1()
{
cout<sno<<"\t"<name<<"\t"<sex<<"\t"<age<sno<<"\t"<name<<"\t"<math<<"\t"<english<<"\t"<computer<