In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the relevant knowledge of how C++ to achieve a simple student performance management system, the content is detailed and easy to understand, the operation is simple and fast, and has a certain reference value. I believe you will have something to gain after reading this C++ article on how to achieve a simple student performance management system. Let's take a look.
Manage.h
# include # include # include using namespace std;// student template class Student {template friend class StudentManage;public: Student () {next = NULL;} private: int Sid;// student number string Sname;// student name string Ssex;// student sex int Sage;// student age int Sscore;// student score Student* next;// pointer to the next node} Template class StudentManage {public: StudentManage (); ~ StudentManage (); StudentManage& SInsert (int k, const T & sid, const string& sname, const string& ssex, const T & sage, const T & sscore); / / insert bool SIsEmpty () const;// to determine the empty int SGetLength () const;// to get the length bool SGetData (int k, T & sid, string& sname, string& ssex, T & sage, T & sscore) / / get data bool SModifyData (int k, const T & sid, const string& sname, const string& ssex, const T & sage, const T & sscore); / / modify int SFind (const int& sid); / / find StudentManage& SDelete (int k, T & sid, string& sname, string& ssex, T & sage, T & sscore) according to id; / / delete void Sort (T a []); void SOutPut (ostream& sout) const;// print private: Student* shead;} / template class Class {template friend class ClassManage;public: Class () {next = NULL;} private: int Cid;// class number string CName;// class name string CBzrName;// head teacher name string CXsName;// student name Class* next;; template class ClassManage {public: ClassManage (); ~ ClassManage () ClassManage& CInsert (int k, const T & cid, const string& cname, const string& cbzrname, const string& cxsname); / insert bool CIsEmpty () const;// to determine the int CGetLength () const;// to get the length bool CGetData (int k, T & cid, string& cname, string& cbzrname, string& cxsname); / / get data bool CModifyData (int k, const T & cid, const string& cname, const string& cbzrname, const string& cxsname) / / modify int CFind (const int& cid); / / find ClassManage& CDelete (int k, T & cid, string& cname, string& cbzrname, string& cxsname) according to id; / / delete void COutPut (ostream& cout) const;// print private: Class* chead;}; / / score template class Grade {template friend class GradeManage;public: Grade () {next = NULL;} private: string Gname; int Gscore Grade* next;}; template class GradeManage {public: GradeManage (); ~ GradeManage (); GradeManage& GInsert (int k, const string& gname, const T & gscore); / / insert bool GIsEmpty () const;// to determine the null int GGetLength () const;// to obtain the length bool GGetData (int k, string& gname, T & gscore); / / get data bool GModifyData (int k, const string& gname, const T & gscore) / / modify int GFind (const string& gname); / / find GradeManage& GDelete (int k, string& gname, T & gscore) based on course name; / / delete void GOutPut (ostream& gout) const;// print private: Grade* ghead;}
Manage.cpp
# include "manage.h" / / Student templateinline StudentManage::StudentManage () {shead = new Student ();} templateStudentManage::~StudentManage () {delete shead;} templateStudentManage& StudentManage::SInsert (int k, const T & sid, const string& sname, const string& ssex, const T & sage, const T & sscore) {Student* p = shead; Student* newNode = new Student; newNode- > Sid = sid; newNode- > Sname = sname; newNode- > Ssex = ssex; newNode- > Sage = sage NewNode- > Sscore = sscore; int len = SGetLength (); if (klen + 1) cout next; newNode- > next = p-> next; p-> next = newNode;} return * this;} templatebool StudentManage::SIsEmpty () const {return shead- > next = = NULL;} templateint StudentManage::SGetLength () const {int length = 0; Student* p = shead- > next; while (p) {length++ P = p-> next;} return length;} templatebool StudentManage::SGetData (int k, T & sid, string& sname, string& ssex, T & sage, T & sscore) {Student* p = shead- > next; int index = 1; if (kSGetLength ()) return false; while (p! = NULL & & index)
< k) { index++; p = p->Next;} if (p = = NULL) return false; else {sid = p-> Sid; sname = p-> Sname; ssex = p-> Ssex; sage = p-> Sage; sscore = p-> Sscore; return true;}} templatebool StudentManage::SModifyData (int k, const T & sid, const string& sname, const string& ssex, const T & sage, const T & sscore) {Student* p = shead- > next Int index = 1; if (kSGetLength ()) return false; while (p! = NULL & & index
< k) { index++; p = p->Next;} if (p = = NULL) return false; else {p-> Sid = sid; p-> Sname = sname; p-> Ssex = ssex; p > Sage = sage; p-> Sscore = sscore; return true;}} templateint StudentManage::SFind (const int& sid) {Student* p = shead- > next; int index = 1 While (p! = NULL & & p-> Sid! = sid) {p = p-> next; index++;} if (p! = NULL) return index; else return 0;} templateStudentManage& StudentManage::SDelete (int k, T & sid, string& sname, string& ssex, T & sage, T & sscore) {if (SGetData (k, sid, sname, ssex, sage, sscore)) {Student* p = shead Student* Q = NULL; for (int I = 1; I
< k; i++) p = p->Next; Q = p-> next; p-> next = Q-> next; delete q;} else cout = 0 & & a [j] > temp;-- j) a [j + 1] = a [j]; a [j + 1] = temp;}} templatevoid StudentManage::SOutPut (ostream& sout) const {Student* p = shead- > next While (p! = NULL) {sout next; while (p) {length++; p = p-> next;} return length;} templatebool ClassManage::CGetData (int k, T & cid, string& cname, string& cbzrname, string& cxsname) {Class* p = chead- > next; int index = 1; if (kCGetLength ()) return false; while (p! = NULL & & index)
< k) { index++; p = p->Next;} if (p = = NULL) return false; else {cid = p-> Cid; cname = p-> CName; cbzrname = p-> CBzrName; cxsname = p-> CXsName; return true;}} templatebool ClassManage::CModifyData (int k, const T & cid, const string& cname, const string& cbzrname, const string& cxsname) {Class* p = chead- > next; int index = 1 If (kCGetLength ()) return false; while (p! = NULL & & index
< k) { index++; p = p->Next;} if (p = = NULL) return false; else {p-> Cid = cid; p-> CName = cname; p-> CBzrName = cbzrname; p-> CXsName = cxsname; return true;}} templateint ClassManage::CFind (const int& cid) {Class* p = chead- > next; int index = 1 While (p! = NULL & & p-> Cid! = cid) {p = p-> next; index++;} if (p! = NULL) return index; else return 0;} templateClassManage& ClassManage::CDelete (int k, T & cid, string& cname, string& cbzrname, string& cxsname) {if (CGetData (k, cid, cname, cbzrname, cxsname)) {Class* p = chead; Class* Q = NULL For (int I = 1; I
< k; i++) p = p->Next; Q = p-> next; p-> next = Q-> next; delete q;} else cout next; while (p! = NULL) {cout next;} return length;} templatebool GradeManage::GGetData (int k, string& gname, T & gscore) {Grade* p = ghead- > next; int index = 1; if (kGGetLength ()) return false; while (p! = NULL & & index)
< k) { index++; p = p->Next;} if (p = = NULL) return false; else {gname = p-> Gname; gscore = p-> Gscore; return true;}} templatebool GradeManage::GModifyData (int k, const string& gname, const T & gscore) {Grade* p = ghead- > next; int index = 1; if (kGGetLength ()) return false; while (p! = NULL & & index
< k) { index++; p = p->Next;} if (p = = NULL) return false; else {p-> Gname = gname; p-> Gscore = gscore; return true;}} templateint GradeManage::GFind (const string& gname) {Grade* p = ghead- > next; int index = 1; while (p! = NULL & & p-> Gname! = gname) {p = p-> next; index++ } if (p! = NULL) return index; else return 0;} templateGradeManage& GradeManage::GDelete (int k, string& gname, T & gscore) {if (GGetData (k, gname, gscore)) {Grade* p = ghead; Grade* Q = NULL; for (int I = 1; I
< k; i++) p = p->Next; Q = p-> next; p-> next = Q-> next; delete q;} else cout next; while (p! = NULL) {gout
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.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.