Home > Back-end >  Define a Student class Student, the main () function to finish the test.
Define a Student class Student, the main () function to finish the test.

Time:03-31

The Student class structure description:
Student class data members include:
(1) private data members: student id no (char []), the name name (char []), age, the age (int),
(2) the static data members: sum (int), the role for the current moment the total number of Student class object,

Student class member functions include:
(1) define and constructor Student (char *, char *, int) and copy constructor Student (Student & amp;) , including arguments Constructor parameter defaults to an empty string, or zero (when the string is NULL to deal with it as an empty string), output information Constructor "run", the copy Constructor output information "CopyConstructor run"
(2) define the Destructor, the Destructor output information "Destructor run"
(3) members of the public function: void setNo (char *) and char * getNo () returns and set no (when parameter to NULL to deal with it as an empty string)
(4) members of the public function: void elegantly-named setName (char *) and char * getName () returns and set the name (when parameter to NULL to deal with it as an empty string)
(5) members of the public function: void setAge (int) and int getAge () returns and set the age
Those members of the public function: the void show () is used to display the current object information age, assume that "student id=20190327, name=doublebest, age=21" students object information display format is as follows:
No: 20190327, Name: doublebest, Age: 21
The referee sample testing program:
#include
using namespace std;

Please fill in the answer here

Int main () {
Char s1 [10]="20190327";
Char s2 [20]="doublebest";
Student stu1 (s1, s2);
Stu1. SetAge (21);
Stu1. The show ();
Student stu2=stu1;
Cin. Getline (s1, 10, '\ n');
Cin. Getline (s2, 20, '\ n');
Stu2. SetNo (s1);
Stu2. Elegantly-named setName (s2);
Stu2. The show ();
return 0;
}
Input the sample:
20190327
Doublebest
The output sample:
The Constructor run
NumTotal: 1
No: 20190327, Name: doublebest, Age: 21
CopyConstructor run
NumTotal: 2
No: 20190327, Name: doublebest, Age: 21
Destructor run
NumTotal: 1
Destructor run
NumTotal: 0

CodePudding user response:

20 need? Emm

CodePudding user response:

reference 1/f, overwhelmed, response:
20 need? Emm

What kind of it? Even though?
  • Related