c++学生管理系统

前言

利用C++写的管理界面,反复调用show()函数,和seclect()函数,
while(cin >> choice),来反复执行。
在windows下 清屏是 system("cls");
linux 下清屏是 system("clear");

代码部分

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#include <iostream>
#include <stdlib.h>
using namespace std;
void show();
void select(char choice);



void show()
{

system("cls");
cout<<"\t\t|--------------学生选课系统(学生版)------------\n";
cout<<"\t\t|\t 0. 返回 |\n";
cout<<"\t\t|\t 1. 学生信息管理 |\n";
cout<<"\t\t|\t 2. 教师信息管理 |\n";
cout<<"\t\t|\t 3. 课程信息管理 |\n";
cout<<"\t\t|\t 4. 学生选课管理 |\n";
cout<<"\t\t|\t 5. 学生成绩管理 |\n";
cout<<"\t\t|\t 6. 信息统计模块 |\n";
cout<<"\t\t|\t-------------------------------------------|\n\n";

}

void select(char choice)
{

if(choice < '0'|| choice > '9' )
{
cout<<"模块应为整数!"<<endl;
}
else if(choice != '0')
{
switch(choice)
{

case '1':
cout<<"\t\t\t你输入的模块名称为:1. 学生信息管理"<<endl;
cout<<"\t\t\t请按任意键继续..."<<endl;
break;
case '2':
cout<<"\t\t\t你输入的模块名称为:2. 教师信息管理"<<endl;
cout<<"\t\t\t请按任意键继续..."<<endl;
break;
case '3':
cout<<"\t\t\t你输入的模块名称为:3. 学生信息管理"<<endl;
cout<<"\t\t\t请按任意键继续..."<<endl;
break;
case '4':
cout<<"\t\t\t你输入的模块名称为:4. 学生选课管理"<<endl;
cout<<"\t\t\t请按任意键继续..."<<endl;
break;
case '5':
cout<<"\t\t\t你输入的模块名称为:5. 学生成绩管理 "<<endl;
cout<<"\t\t\t请按任意键继续..."<<endl;
break;
case '6':
cout<<"\t\t\t你输入的模块名称为:6. 信息统计模块"<<endl;
cout<<"\t\t\t请按任意键继续..."<<endl;
break;
default :
cout<<"\t\t\t你输入的模块不存子!"<<endl;
cout<<"\t\t\t请按任意键继续..."<<endl;
break;
}
}
else{
system("cls");
show();
}
}
int main()
{

show();
cout<<"\t\t\t请输入模块编号(0-6):";
char choice;
while(cin>>choice)
{
select(choice);
cout<<"\t\t\t请输入模块编号(0-6):";
}
return 0;
}

运行效果

学习C++

学习C++,可以多看看C++ primer,C++编程思想,算法题也是提高的重要手段。