Exam registration management

Source: Internet
Author: User

Exam registration management
The examination registration system is a simple simulation of examination registration management. You can use the menu selection method to complete the following functions: Enter the examinee information; output the examinee information; query the examinee information; Add the examinee information; modify the examinee information; delete the examinee information. Each candidate information is composed of the admission ticket number, name, gender, age, and application type.
Requirement: define a special elemtype to describe the examinee information. The data structure is described by a class and named as list, including data, relations, and basic operations; the storage structure of the data structure is implemented using a chain structure.

 

 

 

# Include <iostream> # include <string> # include <stdio. h> # include <windows. h> using namespace STD; int N; struct student {int num; char name [20]; char sex; int age; char leibie [10]; Student * Next ;}; class list {public: // student * creat (); void menu_find (); void find (student * head, int num); void menu_change (); void change (student * head, int num); void menu_del (); Student * delet (student * head, int num); void print (); Void menu_insert (); Student * insert (student * head, student * Stu); Private: Student * head;}; List list; ///////////// Main Menu ////// // void menu () {system ("CLS "); cout <"************************ welcome to the examinee Management System ******* * ***************** "<Endl; cout <"*****" <Endl; cout <"*** 1. create candidate information 2. search for the examinee information ** "<Endl; cout <" ** 3. modify examinee information 4. delete the examinee information ** "<Endl; cout <" ** 5. insert examinee information 6. show the examinee information ** "<Endl; cout <" ** 7. exit ** "<Endl; cout <"************************************* * ***************************** "<Endl; cout <"<char (1) <" Sun Shumin Xue Yingying sun mengyao Ma Hui Ying Ma Rui "<Endl; cout <"Enter the directory number:" <Endl ;} ////////////// create the examinee information /////////// // void list:: creat () {cout <"*** input ends with 0! * *** "<Endl; Student * P1, * P2; n = 0; P1 = P2 = new student; cout <" Enter the examinee: admission Ticket No. Name gender age type "<Endl; CIN> P1-> num; If (P1-> num = 0) {system (" pause "); menu (); return;} CIN> P1-> Name> P1-> sex> P1-> age> P1-> leibie; List. head = NULL; while (P1-> num! = 0) {n = n + 1; if (n = 1) list. head = p1; elsep2-> next = p1; P2 = p1; P1 = new student; cout <"Enter the examinee's admission ticket No. Name: Gender and Age type! "<Endl; CIN> P1-> num; If (P1-> num = 0) break; cin> P1-> Name> P1-> sex> P1-> age> P1-> leibie;} If (P1-> num = 0) system ("pause"); P2-> next = NULL; List. head = head; menu ();} //// // find the examinee information // void list: menu_find () {cout <"***** the input ends with 0! * *** "<Endl; int f_num; cout <" Enter the admission ticket number of the candidate: "<Endl; CIN> f_num; while (f_num! = 0) {list. find (list. head, f_num); cout <"Enter the admission ticket number of the candidate:" <Endl; CIN> f_num;} If (f_num = 0) system ("pause"); menu ();} void list: Find (student * head, int num) {student * P1, * P2; If (Head = NULL) {cout <"***** no candidate information currently! * *** "<Endl; return;} p1 = head; while (num! = P1-> num & P1-> next! = NULL) {P2 = p1; P1 = p1-> next;} If (num = p1-> num) {cout <"the candidate to search for is: "<Endl <"********************************* * *************** "<Endl; cout <"Admission Ticket No.:" <P1-> num <'\ n' <"Last Name: "<P1-> name <'\ n' <" Sex: "<P1-> sex <' \ n' <" age: "<P1-> age <'\ n' <" Applicant type: "<P1-> leibie <Endl; cout <"************************************ * ************ "<Endl; return;} else if (P1-> next = NULL) {cout <"***** cannot find the candidate information! * *** "<Endl; return ;}} //////////// modify the examinee information /////////// void list: menu_change () {cout <"***** the input ends with 0! * *** "<Endl; int xg_num; cout <" Enter the admission ticket number of the candidate you want to modify: "<Endl; CIN> xg_num; while (xg_num! = 0) {list. change (Head, xg_num); cout <"Enter the admission ticket number of the candidate you want to modify:" <Endl; CIN> xg_num;} If (xg_num = 0) system ("pause"); menu ();} void list: Change (student * head, int num) {student * P1, * P2; If (Head = NULL) {cout <"***** no candidate information currently! * *** "<Endl; return;} p1 = head; while (num! = P1-> num) {P2 = p1; P1 = p1-> next;} If (num = p1-> num) {cout <"current information of the candidate you want to modify:" <Endl; cout <"************************************ * ************************* "<Endl; cout <"Admission Ticket No.:" <P1-> num <'\ n' <"Last Name: "<P1-> name <'\ n' <" Sex: "<P1-> sex <' \ n' <" age: "<P1-> age <'\ n' <" Applicant type: "<P1-> leibie <Endl; cout <"************************************ * ************************* "<Endl; cout <"***** enter the information of this candidate again! * *** "<Endl; cout <" re-enter this candidate: Admission Ticket No. Name: gender, age, and enrollment type! "<Endl; int xg_num; char xg_name [20]; char xg_sex; int xg_age; char xg_leibie [10]; cin> xg_num> xg_name> xg_sex> xg_age> xg_leibie; P1-> num = xg_num; strcpy (P1-> name, xg_name ); p1-> sex = xg_sex; P1-> age = xg_age; strcpy (P1-> leibie, xg_leibie); cout <"***** modified successfully! * *** "<Endl; return;} else {cout <" ***** the candidate information cannot be found! * *** "<Endl; return ;}} //// // display the examinee information // void list: Print () {student * P; P = List. head; If (list. head! = NULL) do {cout <"********************************** * ************** "<Endl; cout <"Admission Ticket No.:" <p-> num <'\ n' <"Last Name: "<p-> name <'\ n' <" Sex: "<p-> sex <' \ n' <" age: "<p-> age <'\ n' <" Applicant type: "<p-> leibie <Endl; P = p-> next ;} while (P! = NULL); If (list. Head = NULL) cout <"***** no candidate information currently! * *** "<Endl; cout <"************************************ * ************ "<Endl; system ("pause"); menu ();} /////////////// Delete the examinee information ////////// // void list :: menu_del () {cout <"*** input ends with 0! * *** "<Endl; int del_num; cout <" Enter the admission ticket number you want to delete: "<Endl; CIN> del_num; while (del_num! = 0) {head = List. delet (Head, del_num); cout <"Enter the admission ticket number of the candidate you want to delete:" <Endl; CIN> del_num;} If (del_num = 0) system ("pause"); menu ();} student * List: delet (student * head, int num) {student * P1, * P2; if (Head = NULL) {cout <"***** currently no candidate information! * *** "<Endl; Return (head);} p1 = head; while (num! = P1-> num & P1-> next! = NULL) {P2 = p1; P1 = p1-> next;} If (num = p1-> num) {If (p1 = head) head = p1-> next; elsep2-> next = p1-> next; the examinee information for cout <"***** student ID" <num <"has been deleted! * *** "<Endl; n = n-1;} elsecout <" ***** the candidate information cannot be found! * *** "<Endl; return head ;} /// // Insert the examinee information /////////////////// /void list:: menu_insert () {student * Stu; cout <"***** the input ends with 0! * *** "<Endl; Stu = new student; cout <" Enter the examinee: Admission Ticket No. Name: gender, age, and enrollment type! "<Endl; CIN> stu-> num; If (STU-> num = 0) {system (" pause "); menu (); return ;} cin> stu-> Name> stu-> sex> stu-> age> stu-> leibie; while (STU-> num! = 0) {head = List. insert (Head, Stu); Stu = new student; cout <"Enter the examinee: Admission Ticket number name gender age type! "<Endl; CIN> stu-> num; If (STU-> num = 0) break; cin> stu-> Name> stu-> sex> stu-> age> stu-> leibie; cout <"***** the information of the candidate is successfully inserted! * *** "<Endl;} If (STU-> num = 0) system (" pause "); menu ();} student * List :: insert (student * head, student * Stu) {student * P0, * P1, * P2; P1 = head; p0 = Stu; If (Head = NULL) {head = P0; P0-> next = NULL;} else {While (P0-> num> P1-> num) & (P1-> next! = NULL) {P2 = p1; P1 = p1-> next;} If (P0-> num <= p1-> num) {If (Head = p1) head = P0; elsep2-> next = P0; P0-> next = p1;} else {p1-> next = P0; P0-> next = NULL ;}} N = n + 1; Return (head );} //////////////////////////////////////// //// // int main () {menu (); int num; while (CIN> num) {Switch (Num) {Case 1: {list. creat () ;}; continue; Case 2: {list. menu_find () ;}; continue; Case 3: {list. menu_change () ;}; continue; Case 4: {list. menu_del () ;}; contin UE; Case 5: {list. menu_insert () ;}; continue; Case 6: {list. print () ;}; continue; Case 7: {cout <"***** welcome to the next visit! * *** "<Endl; exit (0) ;}}} return 0 ;} /*************************************** * ********* 101 sunshumin F 19 li102 xueyingying M 20 wen104 mahuiying M 20 wen106 maruihan F 19 li108 sunmengyao M 18 Li 105 sunsm F 23 wen106 xueyy M 22 li *************************************** ***********/

Exam registration management

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.