<> Simple student achievement management system
Write a subject class , Include account name , Subject score 2 Data members , A member function to measure whether or not to pass , Assign value to account object with its constructor . Write a student class , Including student number , full name 2 Data members , And a score object pointer member ( An array of three score objects outside the number of words ), Assign values to the pointer members of the grade object in the constructor of the student class ( Application space ), In the member function of student performance display , Show their three scores one by one and explain whether they passed or not . Only one student object needs to be defined in the main function , Registration and presentation of results
#include<iostream> #include<cstring> using namespace std; class Subjict{
string Sname; int scure; public: Subjict(); void putt(); }; Subjict::Subjict() {
cout<< " Please input subject name :"; cin >> Sname; cout <<" Please input " << Sname << " achievement :" ; cin >> scure;
} void Subjict::putt() { cout << Sname<<scure; if (scure < 60) cout << " fail, "<<
endl; else cout << " pass "<<endl; } class Student { long int xuehao; string name;
Subjict*p; public: Student(); ~Student(); void put(); }; Student::Student() {
name= " Zhang Sanmou "; xuehao = 2019001; p = new Subjict[3]; } Student::~Student() {
delete[] p; } void Student::put() { cout << " Student number :" << xuehao<<", full name :" << name <<
", The results are as follows :"<< endl; p[0].putt(); p[1].putt(); p[2].putt(); } int main() { Student b
; b.put(); return 0; }
Technology