Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to write the code of the simple course selection system realized by C++

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/02 Report--

Today, I will talk to you about how to write the code of the C++ simple course selection system, which may not be well understood by many people. in order to make you understand better, the editor has summarized the following content for you. I hope you can get something according to this article.

Here is the detailed code sharing:

# includeusing namespace std

Declare the function section:

/ / declare function part void BuildMainMenu (); / declare main menu function void SelectSytem (int AID,int who); / / declare course selection system void MyCourse (int AID,int who); / / declare my course schedule void PrintC (int who); / / declare print course schedule function void WrongW (); / / error prompt function

Pre-data processing:

Existing course data course.txt

Existing student data students.txt

Existing teacher data teacher.txt

Merge into date.txt sequentially.

The initial state is:

1. No courses-> Import existing course data (see Course class for details)

two。 Do not have any teacher data-> Import teacher data (see teacher class for details)

3. The teacher did not set any courses at this time.

-> requires the teacher to log in to the system to set up.

This step requires manual data typing. For more information, please see Setcourse.txt.

4. Do not have any student data-> Import student data (see student class for details)

5. If the teaching assistant comes from the students for the time being, the data of the teaching assistant is consistent with that of the students.

6. For students and teaching assistants, you need to enter the course selection system through the student number and the password set.

/ / used to print the border void PrintEgde () {puts ("*");} / / course class class Course {public: int CourseId;// number string cousreName;// name int credit;// credit bool HaveSet=0 / / determine whether the course is set by the teacher. If there is no setting (0), the student cannot choose the Course () {} / / default constructor. Remember to write / / the custom parameter constructor void SetCourse (int aline string bdirection int c) {CourseId=a;cousreName=b;credit=c;}}; / / AllList stores the information of all courses Course AllList [200]; int Cleartotalnum / represents the total number of courses class Person {public: string name / / name int age;// age / / construct Person () {} void SetPerson (string apenint b) {name=a;age=b;}}; class teacher:public Person {public: the number of courses to be taught by the int teacherId;// teacher int Len;// [10]; / / the number of courses taught is int now_have=0. / / number of courses set teacher () {} / / default constructor void Set_Teacher (string Name,int Age,int ID,int n) / / construct {name=Name; age=Age; teacherId=ID; Len=n;} void teach () {coutd > > a > > b > > c / enter the name, age, number, and set the number of courses A _ T [I] .Set _ Teacher (dmemarecy brec);}} void Pre_student () {/ / import all student data int a _ X long long btterstring d _ Magi; scanf ("% d", & S_totalnum); for (int I > d > > a > b > > e A _ S [I] .Set _ student (drecovera recorder bpje); A _ TA [I] .Set _ student (dmemareco bmeme);}} void Pre () / / pre-preparation of course selection system {Pre_course (); / Import course data Pre_teacher (); / / Import teacher data Pre_student () / / Import student data} void WrongW () / / error message {system ("cls"); puts ("You entered the wrong one!"); _ sleep (500);} void MyCourse (int AID,int who) {system ("cls"); puts ("\ n"); PrintEgde () If (who==0) / / students {/ / absence of classes if (A _ S [AID] .roomCount = = 0) puts ("You have no course now!"); / / situation of having classes for (int item1witi)

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report