c++学生管理系统(三)
新建main.cpp
1 #include<iostream> 2 #include "student.h" 3 4 using namespace std; 5 6 void printMenu() { 7 cout << "**********************************" << endl; 8 cout << "*\t0.退出" << endl; 9 cout << "*\t1.打印学生信息" << endl; 10 cout << "*\t2.添加学生信息" << endl; 11 cout << "*\t3.通过学号查询学生信息" << endl; 12 cout << "*\t4.修改学生信息" << endl; 13 cout << "*\t5.删除学生信息" << endl; 14 cout << "*\t6.清屏" << endl; 15 cout << "**********************************" << endl; 16 cout<< "please select:" << endl; 17 } 18 19 void keyDown() { 20 Student *stu_head = NULL; 21 22 int key; 23 string sno; 24 while(1) { 25 printMenu(); 26 cin >> key; 27 switch(key){ 28 case 0: 29 exit(0); 30 case 1: 31 displayStudent(stu_head); 32 break; 33 case 2: 34 stu_head = addStudent(stu_head); 35 displayStudent(stu_head); 36 break; 37 case 3: 38 searchStudent(stu_head); 39 break; 40 case 4: 41 modStudent(stu_head); 42 break; 43 case 5: 44 cout << "please input student no:" << endl; 45 cin >> sno; 46 stu_head = delStudentByNo(stu_head, sno); 47 break; 48 case 6: 49 system("clear"); 50 break; 51 default: 52 cout << "not expected select" << endl; 53 break; 54 } 55 56 } 57 } 58 59 int main() { 60 keyDown(); 61 return 0; 62 }