经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » 程序设计 » C++ » 查看文章
C++实现简易选课系统代码分享
来源:jb51  时间:2022/1/3 12:31:45  对本文有异议

下面是详细代码分享:

  1. #include<bits/stdc++.h>
  2. using namespace std;

声明函数部分:

  1. //声明函数部分
  2. void BuildMainMenu();//声明主菜单函数
  3. void SelectSytem(int AID,int who);//声明选课系统
  4. void MyCourse(int AID,int who);//声明我的课表
  5. void PrintC(int who);//声明打印课表函数
  6. void WrongW();//错误提示函数

前置数据处理:

  • 现有课程数据course.txt
  • 现有学生数据students.txt
  • 现有老师数据 teacher.txt
  • 按顺序合并为date.txt.

初始状态为:

  • 1.无任何课程->导入现有课程数据 (具体内容见Course类)
  • 2.无任何老师数据->导入老师数据 (具体内容见teacher类)
  • 3.此时老师并没有设置任何课程
  •     ->需要老师登陆系统进行设置
  •     该步骤需要手动键入数据,参考数据见Setcourse.txt
  • 4.无任何学生数据->导入学生数据 (具体内容见student类)
  • 5.暂且令助教来自于学生,则助教的数据和学生数据一致
  • 6.对于学生和助教,需通过学号和所设密码进入选课系统
  1. //用于打印边框
  2. void PrintEgde(){puts("**********************************************");}
  3.  
  4. //课程类
  5. class Course
  6. {
  7. public:
  8. ?? ?int CourseId;//编号
  9. ?? ?string cousreName;//名称
  10. ?? ?int credit;//学分
  11. ?? ?bool HaveSet=0;//判断该门课是否被老师设置,没有设置(0)则不能被学生选择
  12.  
  13. ?? ?Course(){}//默认构造函数,要记得写
  14. ?? ?//自定义的含参构造函数
  15. ?? ?void SetCourse(int a,string b,int c){CourseId=a;cousreName=b;credit=c;}
  16. };
  17. //AllList 存储所有课程的信息
  18. Course AllList[200];
  19. int C_totalnum;//代表课程的总数
  20.  
  21. class Person
  22. {
  23. public:
  24. ?? ?string name;//姓名
  25. ?? ?int age;//年龄
  26. ?? ?//构造
  27. ?? ?Person(){}
  28. ?? ?void SetPerson(string a,int b){name=a;age=b;}
  29. };
  30.  
  31. class teacher:public Person
  32. {
  33. public:
  34. ?? ?int teacherId;//老师的编号
  35. ?? ?int Len;//需要教授的课程数量
  36. ?? ?int TeachCourse[10];//所授课程ID编号
  37. ?? ?int now_have=0;//已设置课程数量
  38. ?? ?teacher(){}//默认构造函数
  39.  
  40. ?? ?void Set_Teacher(string Name,int Age,int ID,int n)//构造
  41. ?? ?{
  42. ?? ??? ?name=Name;
  43. ?? ??? ?age=Age;
  44. ?? ??? ?teacherId=ID;
  45. ?? ??? ?Len=n;
  46. ?? ?}
  47.  
  48. ?? ?void teach(){cout<<"I am a teacher,I teach my student\n";}
  49.  
  50. ?? ?//删除已经设置的课程
  51. ?? ?void DeleteC(int CID)
  52. ?? ?{
  53. ?? ??? ?system("cls");//用于清空cmd窗口
  54.  
  55. ?? ??? ?//如果当前没有课程可以删除就直接返回
  56. ?? ??? ?if(now_have==0)?
  57. ?? ??? ?{
  58. ?? ??? ??? ?puts("You have set no course!");
  59. ?? ??? ??? ?_sleep(500);//用于暂停0.5s
  60. ?? ??? ??? ?return;
  61. ?? ??? ?}
  62.  
  63. ?? ??? ?//CAN用于判断是否能取消设置某一门课(即要取消的课是否已被设置)
  64. ?? ??? ?int CAN=0;
  65. ?? ??? ?for(int i=1;i<=now_have;i++)
  66. ?? ??? ?{
  67. ?? ??? ??? ?if(TeachCourse[i]==CID)
  68. ?? ??? ??? ?{
  69. ?? ??? ??? ??? ?//可以取消,那么把原本设置好的最后一门课放到要取消的课的位置上
  70. ?? ??? ??? ??? ?TeachCourse[i]=TeachCourse[now_have];
  71. ?? ??? ??? ??? ?now_have--;
  72. ?? ??? ??? ??? ?CAN=1;
  73. ?? ??? ??? ??? ?break;
  74. ?? ??? ??? ?}
  75. ?? ??? ?}
  76. ?? ??? ?if(CAN==1) puts("You successfully deleted the course!");
  77. ?? ??? ?else puts("There is no such course!");//不能取消设置的情况
  78. ?? ??? ?_sleep(800);
  79. ?? ?}
  80.  
  81. ?? ?void PrintNowteach()//输出已设置课程
  82. ?? ?{
  83. ?? ??? ?system("cls");
  84. ?? ??? ?puts(" ? ? ? ? ? ? <M y C o u r s e> ? ? ? ? ? ? ?\n");
  85. ?? ??? ?PrintEgde();
  86.  
  87. ?? ??? ?//如果没有课
  88. ?? ??? ?if(now_have==0) puts("You have no course now!");
  89. ?? ??? ?//如果有课
  90. ?? ??? ?for(int i=1;i<=now_have;i++)
  91. ?? ??? ?{
  92. ?? ??? ??? ?int x=TeachCourse[i];//取出课程编号方便下一行书写
  93. ?? ??? ??? ?printf("*%5d ? ?%-29s %4d *\n",AllList[x].CourseId,AllList[x].cousreName.c_str(),AllList[x].credit);
  94. ?? ??? ?}
  95. ?? ??? ?PrintEgde();putchar('\n');
  96. ?? ??? ?printf({"You can input The CourseID to delete:(or -1 to return)"});
  97.  
  98. ?? ??? ?int flag=0;scanf("%d",&flag);
  99. ?? ??? ?if(flag==-1) return;//返回上一级系统
  100. ?? ??? ?else if(flag>0 && flag<=C_totalnum)//如果输入的数字在限定范围之内
  101. ?? ??? ?{
  102. ?? ??? ??? ?DeleteC(flag);//取消设置
  103. ?? ??? ??? ?PrintNowteach();//并重置该页面
  104. ?? ??? ?}
  105. ?? ??? ?else//如果输入的数字不在预设范围内,进行报错提示
  106. ?? ??? ?{
  107. ?? ??? ??? ?WrongW();
  108. ?? ??? ??? ?PrintNowteach();
  109. ?? ??? ?}
  110. ?? ?}
  111. ?? ?void setCourse(int CourseID)
  112. ?? ?//在已有课程中选择属于自己Teach的课程编号
  113. ?? ?{
  114. ?? ??? ?system("cls");
  115. ?? ??? ?//如果已经选满了
  116. ?? ??? ?if(Len-now_have<=0)?
  117. ?? ??? ?{
  118. ?? ??? ??? ?puts("You have already set all of your courses!");
  119. ?? ??? ??? ?_sleep(800);return;
  120. ?? ??? ?}
  121. ?? ??? ?if(AllList[CourseID].HaveSet!=0)//如果已经被别人设置了
  122. ?? ??? ??? ?puts("This course has been set!");
  123. ?? ??? ?else
  124. ?? ??? ?{
  125. ?? ??? ??? ?puts("You successfully set the course!");
  126. ?? ??? ??? ?TeachCourse[++now_have]=CourseID;
  127. ?? ??? ??? ?AllList[CourseID].HaveSet=1;
  128. ?? ??? ?}
  129. ?? ??? ?_sleep(800);
  130. ?? ?}
  131. };
  132. teacher A_T[200];//所有老师的信息
  133. int T_totalnum;
  134.  
  135. class student:public Person
  136. {
  137. public:
  138. ?? ?long long number;//学号
  139. ?? ?int courseCount=0;//已选课程数目
  140. ?? ?int mycourse[20];//已选课程的课程编号
  141. ?? ?int LeastNum;//至少选择课程数目
  142. ?? ?string key;//密码
  143.  
  144. ?? ?student(){}
  145. ?? ?//此处age表示入学年份,如2021,2020
  146. ?? ?void Set_student(string Name,int Age,long long Num,int n,string Key)
  147. ?? ?{
  148. ?? ??? ?name=Name;
  149. ?? ??? ?age=Age;
  150. ?? ??? ?number=Num;//学号
  151. ?? ??? ?LeastNum=n;
  152. ?? ??? ?key=Key;
  153. ?? ??? ?memset(mycourse,0,sizeof(mycourse));//初始化已选课程数组
  154. ?? ?}
  155.  
  156. ?? ?void selectCourse(int CourseID)
  157. ?? ?{
  158. ?? ??? ?system("cls");
  159. ?? ??? ?//用于判断自己是否已经选过这门课程
  160. ?? ??? ?bool HaveChoose = 0;
  161. ?? ??? ?for(int i=1;i<=courseCount;i++)
  162. ?? ??? ??? ?if(CourseID==mycourse[i])?
  163. ?? ??? ??? ??? ?HaveChoose=1;
  164.  
  165. ?? ??? ?//如果该门课已经被老师设置并且自己没有选过
  166. ?? ??? ?if(AllList[CourseID].HaveSet && HaveChoose==0)
  167. ?? ??? ?{
  168. ?? ??? ??? ?puts("You successfully stlect the course!");
  169. ?? ??? ??? ?mycourse[++courseCount]=CourseID;
  170. ?? ??? ?}
  171. ?? ??? ?//老师没有设置课程
  172. ?? ??? ?else if(AllList[CourseID].HaveSet==0) puts("There is no such course!");
  173. ?? ??? ?//自己已经选过
  174. ?? ??? ?else if(HaveChoose==1) puts("This course you have chosen!");
  175. ?? ??? ?_sleep(800);
  176. ?? ?}
  177.  
  178. ?? ?void Delete(int CID)
  179. ?? ?{
  180. ?? ??? ?system("cls");
  181. ?? ??? ?if(courseCount==0) return;
  182. ?? ??? ?int CAN;
  183. ?? ??? ?for(int i=1;i<=courseCount;i++)
  184. ?? ??? ?{
  185. ?? ??? ??? ?if(mycourse[i]==CID)
  186. ?? ??? ??? ?{
  187. ?? ??? ??? ??? ?mycourse[i]=mycourse[courseCount];
  188. ?? ??? ??? ??? ?courseCount--;
  189. ?? ??? ??? ??? ?CAN=1;
  190. ?? ??? ??? ??? ?break;
  191. ?? ??? ??? ?}
  192. ?? ??? ?}
  193. ?? ??? ?if(CAN==1) puts("You successfully deleted the course!");
  194. ?? ??? ?else puts("There is no such course!");
  195. ?? ??? ?_sleep(800);
  196. ?? ?}
  197.  
  198. ?? ?//判断是否满足学校要求
  199. ?? ?void judge()
  200. ?? ?{
  201. ?? ??? ?if(courseCount>=LeastNum) //比较已选课程和要求课程数量
  202. ?? ??? ??? ?puts("You can complete the credits of this semester");
  203. ?? ??? ?else?
  204. ?? ??? ??? ?printf("You need to choose %d more courses\n",LeastNum-courseCount);
  205. ?? ?}
  206. };
  207. student A_S[2000];//所有学生的信息
  208. int S_totalnum;//学生的总数
  209.  
  210. class TeachingAssistant:public teacher,public student
  211. {
  212. public:
  213. ?? ?void teach(){puts("I am a teaching assistant,I help my teacher teach his students");}
  214. ?? ?TeachingAssistant(){}
  215.  
  216. ?? ?void selectCourse(int CourseID)
  217. ?? ?{
  218. ?? ??? ?system("cls");
  219. ?? ??? ?if(AllList[CourseID].HaveSet)
  220. ?? ??? ?{
  221. ?? ??? ??? ?puts("You successfully stlect the course!");
  222. ?? ??? ??? ?mycourse[++courseCount]=CourseID;
  223. ?? ??? ?}
  224. ?? ??? ?else puts("There is no such course!");
  225. ?? ??? ?_sleep(800);
  226. ?? ?}
  227.  
  228. ?? ?void Delete(int CID)
  229. ?? ?{
  230. ?? ??? ?system("cls");
  231. ?? ??? ?if(courseCount==0) return;
  232. ?? ??? ?int CAN;
  233. ?? ??? ?for(int i=1;i<=courseCount;i++)
  234. ?? ??? ?{
  235. ?? ??? ??? ?if(mycourse[i]==CID)
  236. ?? ??? ??? ?{
  237. ?? ??? ??? ??? ?mycourse[i]=mycourse[courseCount];
  238. ?? ??? ??? ??? ?courseCount--;
  239. ?? ??? ??? ??? ?CAN=1;
  240. ?? ??? ??? ??? ?break;
  241. ?? ??? ??? ?}
  242. ?? ??? ?}
  243. ?? ??? ?if(CAN==1) puts("You successfully deleted the course!");
  244. ?? ??? ?else puts("There is no such course!");
  245. ?? ??? ?_sleep(800);
  246. ?? ?}
  247. };
  248. TeachingAssistant A_TA[2500];
  249.  
  250. void Pre_course()
  251. {
  252. ?? ?//导入所有课程数据
  253. ?? ?int a,b;string c;
  254. ?? ?freopen("date.txt","r",stdin);
  255. ?? ?scanf("%d",&C_totalnum);
  256. ?? ?for(int i=1;i<=C_totalnum;i++)
  257. ?? ?{
  258. ?? ??? ?cin>>a>>c>>b;
  259. ?? ??? ?//输入编号,名称,学分
  260. ?? ??? ?AllList[i].SetCourse(a,c,b);
  261. ?? ?}
  262. }
  263.  
  264. void Pre_teacher()
  265. {
  266. ?? ?//导入所有老师数据
  267. ?? ?int a,b,c;string d;
  268. ?? ?scanf("%d",&T_totalnum);
  269. ?? ?for(int i=1;i<=T_totalnum;i++)
  270. ?? ?{
  271. ?? ??? ?cin>>d>>a>>b>>c;
  272. ?? ??? ?//输入姓名,年龄,编号,应设置课程数量
  273. ?? ??? ?A_T[i].Set_Teacher(d,a,b,c);
  274. ?? ?}
  275. }
  276.  
  277. void Pre_student()
  278. {
  279. ?? ?//导入所有学生数据
  280. ?? ?int a;long long b;string d,e;
  281. ?? ?scanf("%d",&S_totalnum);
  282. ?? ?for(int i=1;i<=S_totalnum;i++)
  283. ?? ?{
  284. ?? ??? ?//姓名 入学年份 学号 至少选课数统一为2
  285. ?? ??? ?cin>>d>>a>>b>>e;
  286. ?? ??? ?A_S[i].Set_student(d,a,b,2,e);
  287. ?? ??? ?A_TA[i].Set_student(d,a,b,2,e);
  288. ?? ?}
  289. }
  290.  
  291. void Pre()
  292. //选课系统前置准备工作
  293. {
  294. ?? ?Pre_course();//导入课程数据
  295. ?? ?Pre_teacher();//导入老师数据
  296. ?? ?Pre_student();//导入学生数据
  297. }
  298.  
  299. void WrongW()//报错提示
  300. {
  301. ?? ?system("cls");
  302. ?? ?puts("You entered the wrong one!");
  303. ?? ?_sleep(500);
  304. }
  305.  
  306. void MyCourse(int AID,int who)
  307. {
  308. ?? ?system("cls");
  309. ?? ?puts(" ? ? ? ? ? ? <M y C o u r s e> ? ? ? ? ? ? ?\n");
  310. ?? ?PrintEgde();
  311. ?? ?if(who==0)//学生
  312. ?? ?{
  313. ?? ??? ?//没课的情况
  314. ?? ??? ?if(A_S[AID].courseCount==0) puts("You have no course now!");
  315. ?? ??? ?//有课的情况
  316. ?? ??? ?for(int i=1;i<=A_S[AID].courseCount;i++)
  317. ?? ??? ?{
  318. ?? ??? ??? ?int x=A_S[AID].mycourse[i];
  319. ?? ??? ??? ?printf("*%5d ? ?%-29s %4d *\n",AllList[x].CourseId,AllList[x].cousreName.c_str(),AllList[x].credit);
  320. ?? ??? ?}
  321. ?? ??? ?PrintEgde();putchar('\n');
  322. ?? ??? ?A_S[AID].judge();
  323. ?? ?}
  324. ?? ?else
  325. ?? ?{
  326. ?? ??? ?if(A_TA[AID].courseCount==0) puts("You have no course now!");
  327. ?? ??? ?for(int i=1;i<=A_TA[AID].courseCount;i++)
  328. ?? ??? ?{
  329. ?? ??? ??? ?int x=A_TA[AID].mycourse[i];
  330. ?? ??? ??? ?printf("*%5d ? ?%-29s %4d *\n",AllList[x].CourseId,AllList[x].cousreName.c_str(),AllList[x].credit);
  331. ?? ??? ?}
  332. ?? ??? ?PrintEgde();putchar('\n');
  333. ?? ?}
  334. ?? ?//是否进行退课操作
  335. ?? ?printf({"You can input The CourseID to delete:(or -1 to return)"});
  336. ?? ?int flag=0;scanf("%d",&flag);
  337. ?? ?if(flag==-1) SelectSytem(AID,who);
  338. ?? ?else if(flag>0 && flag<=C_totalnum)
  339. ?? ?{
  340. ?? ??? ?if(who==0) A_S[AID].Delete(flag);
  341. ?? ??? ?else A_TA[AID].Delete(flag);
  342. ?? ??? ?MyCourse(AID,who);
  343. ?? ?}
  344. ?? ?else {WrongW();MyCourse(AID,who);}
  345. }
  346.  
  347. void PrintC(int who)
  348. //打印所有课程信息
  349. {
  350. ?? ?puts(" ? ? ? ? ? <Course Information> ? ? ? ? ? ? \n");
  351. ?? ?PrintEgde();
  352. ?? ?puts("*Course Id ? ? ? Name ? ? ? ? ? ? ? Credit ? *");
  353. ? ? PrintEgde();
  354. ?? ?if(who==1)//老师和助教
  355. ? ? ?? ?for(int i=1;i<=C_totalnum;i++)
  356. ?? ??? ??? ?printf("*%5d ? ?%-29s %4d *\n",AllList[i].CourseId,AllList[i].cousreName.c_str(),AllList[i].credit);
  357. ?? ?else//学生
  358. ?? ? ? ?for(int i=1;i<=C_totalnum;i++)
  359. ?? ??? ??? ?if(AllList[i].HaveSet)
  360. ?? ??? ??? ??? ?printf("*%5d ? ?%-29s %4d *\n",AllList[i].CourseId,AllList[i].cousreName.c_str(),AllList[i].credit);
  361. ?? ?PrintEgde();putchar('\n');
  362. }
  363.  
  364. void SelectSytem(int AID,int who)
  365. //who 0 代表学生 1 代表助教
  366. {
  367. ?? ?system("cls");
  368. ?? ?//打印所有课程信息
  369. ?? ?PrintC(0);
  370. ?? ?//输出学生姓名 .c_str()的作用是将string类型的数据转成char类型,使得它可以用printf输出
  371. ?? ?printf("Student: %s .",A_S[AID].name.c_str());
  372. ?? ?if(who==0)?
  373. ?? ??? ?A_S[AID].judge();//学生
  374. ?? ?printf("Please enter the Course Id to select\nYou can input -1 to exit\nYou can input -2 to check Mycourse and delete course\nNow enter a number:");
  375. ?? ?int flag=0;scanf("%d",&flag);
  376. ?? ?if(flag==-1) BuildMainMenu();//返回上一级菜单
  377. ?? ?else if(flag==-2) MyCourse(AID,who);//查看已选课表
  378. ?? ?else if(flag>0 && flag<=C_totalnum)//数据在预设范围内,则选课
  379. ?? ?{
  380. ?? ??? ?if(who==0)//学生
  381. ?? ??? ??? ?A_S[AID].selectCourse(flag),SelectSytem(AID,who);
  382. ?? ??? ?else A_TA[AID].selectCourse(flag),SelectSytem(AID,who);//助教
  383. ?? ?}
  384. ?? ?else {WrongW();SelectSytem(AID,who);}//报错
  385. }
  386.  
  387. void StudentSystem(int who)
  388. {
  389. ?? ?system("cls");
  390. ?? ?//切换到从控制台输入数据
  391. ?? ?freopen("CON","r",stdin);?
  392. ?? ?//接下来为登陆页面
  393.  
  394. ?? ?puts("Please enter your student number and ?password\n");
  395. ?? ?PrintEgde();putchar('\n');
  396. ?? ?printf("Student number:");long long SN;//输入学号
  397. ?? ?scanf("%lld",&SN);
  398. ?? ?printf("Password: ? ? ?");
  399. ?? ?char Pas[20],Acs[20];scanf("%s",Pas);//输入密码
  400. ?? ?int AID;//在数据库中的序号
  401. ?? ?//在数据库中找到学号对应的正确密码
  402. ?? ?for(int i=1;i<=S_totalnum;i++)
  403. ?? ??? ?if(A_S[i].number==SN){strcpy(Acs,A_S[i].key.c_str());AID=i;break;}
  404. ?? ?int times=2;//输入密码的机会
  405. ?? ?while(strcmp(Acs,Pas)!=0 && times>0)
  406. ?? ?//看输入的密码与正确密码是否匹配,以及次数是否耗尽
  407. ?? ?{
  408. ?? ??? ?puts("Wrong Password!!!");
  409. ?? ??? ?printf("you have %d times to enter the correct password\n",times);
  410. ?? ??? ?times--;scanf("%s",Pas);
  411. ?? ?}
  412. ?? ?//次数耗尽推出系统
  413. ?? ?if(times==0)
  414. ?? ?{
  415. ?? ??? ?puts("I am sorry you can't enter our system!");
  416. ?? ??? ?_sleep(800);exit(0);
  417. ?? ?}
  418. ?? ?if(who==0) SelectSytem(AID,who);//学生
  419. ?? ?else SelectSytem(AID,1);//助教
  420. }
  421.  
  422. //老师设置课程
  423. void Setcourse(int TID)
  424. {
  425. ?? ?system("cls");
  426. ?? ?printf("Welcome : %s\n",A_T[TID].name.c_str());
  427. ?? ?printf("You need to set %d courses\n\n",A_T[TID].Len-A_T[TID].now_have);
  428. ?? ?PrintC(1);
  429. ?? ?printf("Please enter the Course Id to set\nYou can input -1 to exit\nYou can input -2 to check Mycourse\nNow enter a number:");
  430. ?? ?int flag=0;scanf("%d",&flag);
  431. ?? ?if(flag==-1) BuildMainMenu();
  432. ?? ?else if(flag==-2) A_T[TID].PrintNowteach(),Setcourse(TID);//查看已设置的课程
  433. ?? ?else if(flag>0 && flag<=C_totalnum)//设置课程
  434. ?? ??? ?A_T[TID].setCourse(flag),Setcourse(TID);
  435. ?? ?else {WrongW();Setcourse(TID);}
  436. }
  437.  
  438. void TeacherSystem()
  439. {
  440. ?? ?system("cls");
  441. ?? ?freopen("CON","r",stdin); //切换到从控制台输入数据
  442. ?? ?puts(" ? ? ? ? Welcome ?to ?Teacher ?system! ? ? ? ?");
  443. ?? ?PrintEgde();putchar('\n');
  444. ?? ?//输入教师编号以进入系统
  445. ?? ?printf("Please enter your Teacher Id:");
  446. ?? ?int TID;scanf("%d",&TID);
  447. ?? ?if(TID>0 && TID<=T_totalnum)
  448. ?? ??? ?Setcourse(TID);
  449. ?? ?else{
  450. ?? ??? ?WrongW();TeacherSystem();
  451. ?? ?}
  452. }
  453.  
  454. void TASystem()
  455. {
  456. ?? ?//实际上助教系统可以看错和学生是一个系统的
  457. ?? ?StudentSystem(1);
  458. }
  459.  
  460. //构建主菜单
  461. void BuildMainMenu()
  462. {
  463. ?? ?system("cls");
  464. ?? ?freopen("CON","r",stdin); //切换到从控制台输入数据
  465. ?? ?puts(" ? ? ?Welcome to course selection system! ? ? ");
  466. ?? ?PrintEgde();
  467. ?? ?puts("* ? ? ? ? 1.Student entrance ? ? ? ? ? ? ? ? *");
  468. ?? ?puts("* ? ? ? ? 2.Teacher entrance ? ? ? ? ? ? ? ? *");
  469. ?? ?puts("* ? ? ? ? 3.TeachingAssistant ? ? ? ? ? ? ? ?*");
  470. ?? ?puts("* ? ? ? ?-1.Exit this system ? ? ? ? ? ? ? ? *");
  471. ?? ?PrintEgde();putchar('\n');
  472. ?? ?printf("Please input 1,2,3 or -1 to enter this system:");
  473. ?? ?int flag=-1;scanf("%d",&flag);//进入子系统
  474. ?? ?if(flag==1) StudentSystem(0);
  475. ?? ?else if(flag==2) TeacherSystem();
  476. ?? ?else if(flag==3) TASystem();
  477. ?? ?else if(flag==-1) exit(0);
  478. ?? ?else
  479. ?? ?{
  480. ?? ??? ?WrongW();
  481. ?? ??? ?BuildMainMenu();
  482. ?? ?}
  483. }
  484.  
  485. int main()//主函数
  486. {
  487. ? ? Pre();//前置数据导入
  488. ?? ?BuildMainMenu();//构建主菜单
  489. ?? ?return 0;
  490. }
  1. /*
  2. date.txt
  3. 10?
  4. 1 Media_English 2
  5. 2 Literature_English 2
  6. 3 Drama_English 2
  7. 4 Academic_English 2
  8. 5 Cross-cultural_Communication 2
  9. 6 Public_Speaking 2
  10. 7 Intermediate_English_Speaking 2
  11. 8 Intermediate_English_Writing 2
  12. 9 Basic_Russian 2
  13. 10 Basic_French 2
  14. 5
  15. Harry_potter 35 1 2
  16. Hermione 34 2 3
  17. Henry_rowen 36 3 1
  18. Snape 55 4 2
  19. Dumbledore 46 5 2
  20. 2
  21. Jack 2021 2021001 123456!
  22. Tom 2021 2021002 abc123
  23. */

到此这篇关于C++实现简易选课系统代码分享的文章就介绍到这了,更多相关C++实现选课系统内容请搜索w3xue以前的文章或继续浏览下面的相关文章希望大家以后多多支持w3xue!

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号