Home > Back-end >  There is no c bosses, inquire
There is no c bosses, inquire

Time:10-20

Define a structure student students, including the student's student id, name, gender and date of birth, date of birth, including (date) (month) (year) program, the output of a student all information,

CodePudding user response:

 # include 
using namespace std;
The class Student
{
Public:
Int id;
string name;
String sex;
String birthday;
Student (int, string n, string s, string bir)
{
Id=I;
Name=n;
Sex=s;
Birthday=bir;
}
Void the show ()
{
Cout & lt; <"Id:" & lt; Cout & lt; <"Name:" & lt; Cout & lt; <"Sex:" & lt; Cout & lt; <"Birthday:" & lt; }
};
Int main ()
{
Student s (001, "Michael", "man", "19 XX, XX, XX");
S.s how ();
return 0;
}


Id: 1
Name: Michael
Sex: man
19 XX, XX, XX birthday:

Process finished with exit code 0

CodePudding user response:

Structure, structure, structure
Is a struct not class
The above code, put the class into a struct and other still

CodePudding user response:

Fun
reference 2 floor response:
structure, structure, structure
Is a struct not class
The above code, put the class into a struct and other still

Thank you????????

CodePudding user response:

reference 1/f, Michael amin's reply:
 # include 
using namespace std;
The class Student
{
Public:
Int id;
string name;
String sex;
String birthday;
Student (int, string n, string s, string bir)
{
Id=I;
Name=n;
Sex=s;
Birthday=bir;
}
Void the show ()
{
Cout & lt; <"Id:" & lt; Cout & lt; <"Name:" & lt; Cout & lt; <"Sex:" & lt; Cout & lt; <"Birthday:" & lt; }
};
Int main ()
{
Student s (001, "Michael", "man", "19 XX, XX, XX");
S.s how ();
return 0;
}


Id: 1
Name: Michael
Sex: man
19 XX, XX, XX birthday:

The Process finished with exit code 0

Thank you very much!!!

CodePudding user response:

reference 4 floor zxr_jwbq response:
Quote: reference 1/f, Michael amin's reply:
 # include 
using namespace std;
The class Student
{
Public:
Int id;
string name;
String sex;
String birthday;
Student (int, string n, string s, string bir)
{
Id=I;
Name=n;
Sex=s;
Birthday=bir;
}
Void the show ()
{
Cout & lt; <"Id:" & lt; Cout & lt; <"Name:" & lt; Cout & lt; <"Sex:" & lt; Cout & lt; <"Birthday:" & lt; }
};
Int main ()
{
Student s (001, "Michael", "man", "19 XX, XX, XX");
S.s how ();
return 0;
}


Id: 1
Name: Michael
Sex: man
19 XX, XX, XX birthday:

The Process finished with exit code 0

Thank you very much!!!

You're welcome
  • Related