Student Achievement Management System

Source: Internet
Author: User

The student achievement Information Management System Based on the console enables student achievement management, increases, deletes, queries, and calculates the total score, and allows you to view the total score ranking;

Technology used: C ++ and STL will be improved in the future, including adding comments, encapsulating the added student functions into a method, and improving the output format and other details.

# Include <iostream> # include <string> # include <list> # include <algorithm> using namespace STD; class student {PRIVATE: int no; string name; double math; double Eng; double CHN; double cpro; double sum; public: Student (INT No, string name, double math, double Eng, double CHN, double cpro) {No = no; name = Name; math = math; Eng = ENG; CHN = CHN; cpro = cpro; sum = math + Eng + CHN + cpro;} void print () {cout <no <"" <name <"" <m Ath <"" <Eng <"" <CHN <"" <cpro <"" <sum <Endl;} int getno () {return no;} double getsum () {return sum ;}~ Student () {}}; void print (list <student> lst); void print_no (list <student> & lst); void cmp_no (student & ST1, student & st2 ); void print_sum (list <student> & lst); void find (list <student> & lst); int del (list <student> & lst); void main_remid (); void score_remind (); int main () {int no; string name; double math; double Eng; double CHN; double cpro; List <student> lst; char op = ''; main_remid (); While (op! = 'Q') {CIN> op; Switch (OP) {Case '1': score_remind (); print_no (LST); break; Case '3 ': find (LST); break; Case '4': del (LST); break; Case '5': score_remind (); print_sum (LST); break; Case '6 ': main_remid (); break; Case '2': cout <"Enter the student ID to be added:" <Endl; CIN> NO; bool flag = false; for (list <student >:: iterator it = lst. begin (); it! = Lst. end (); It ++) if (NO = It-> getno () {cout <"failed to add. This student ID already exists, please repeat "<Endl; flag = true;} If (FLAG) break; cout <" enter the name of the student to be added "<Endl; CIN> name; cout <"Enter the score of the student to be added:" <Endl; CIN> math; cout <"Enter the score of the student in English to be added: "<Endl; CIN> Eng; cout <" Enter the Chinese score of the students to be added: "<Endl; CIN> CHN; cout <"Enter the C language score of the student to be added:" <Endl; CIN> cpro; Student ST (No, name, math, Eng, CHN, cpro ); lst. push_back (ST); break;} If (op! = 'Q') cout <"continue to select the operation you want:" <Endl;} return 0;} void addst () {} void print (list <student> lst) {for (list <student >:: iterator it = lst. begin (); it! = Lst. end (); It ++) IT-> Print ();} void print_no (list <student> & lst) {Int J, I = 0; int A [1024] = {0}; For (list <student >:: iterator it = lst. begin (); it! = Lst. end (); It ++) A [I ++] = it-> getno (); sort (A, A + I); For (j = 0; j <I; j ++) for (list <student>: iterator Jt = lst. begin (); JT! = Lst. end (); JT ++) if (a [J] = JT-> getno () JT-> Print ();} void print_sum (list <student> & lst) {int I = 0; Double A [1024] = {0}; For (list <student >:: iterator it = lst. begin (); it! = Lst. end (); It ++) A [I ++] = it-> getsum (); sort (A, A + I); While (I --) for (list <student >:: iterator Jt = lst. begin (); JT! = Lst. end (); JT ++) if (a [I] = JT-> getsum () JT-> Print ();} void find (list <student> & lst) {cout <"Enter the student ID to query:" <Endl; int no; CIN> NO; for (list <student >:: iterator it = lst. begin (); it! = Lst. end (); It ++) {If (NO = It-> getno () IT-> Print (); If (IT = lst. end () cout <"this student ID does not exist. Please reselect the operation" <Endl ;}} int del (list <student> & lst) {cout <"Enter the student ID to delete:" <Endl; int no; CIN> NO; For (list <student>: iterator it = lst. begin (); it! = Lst. end (); It ++) if (NO = It-> getno () {lst. erase (it); Return 0;} cout <"deletion failed, this student ID does not exist" <Endl;} void main_remid () {cout <"select the operation to be executed" <Endl; cout <"1. query the score information of all students "<Endl; cout <" 2. add students "<Endl; cout <" 3. search for students "<Endl; cout <" 4. delete student "<Endl; cout <" 5. view the total score ranking "<Endl; cout <" 6. view the prompt "<Endl; cout <" Q. exit System "<Endl;} void score_remind () {cout <"student ID" <"name" <"Mathematics" <"English" <"C Language" <"total score" <Endl ;}

 

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.