1 #include <iostream> 2 #include <iomanip> 3 #include <string> 4 5 using namespace std; 6 7 struct Student 8 { 9 int num; 10 string name; 11 char sex; 12 int age; 13 Student(int newnum,string newname,char newsex,int newage):num(newnum),name(newname),sex(newsex),age(age) 14 { 15 cout<<"Num: "<<num<<endl; 16 cout<<"Name: "<<name<<endl; 17 cout<<"Sex: "<<sex<<endl; 18 cout<<"Age: "<<age<<endl; 19 } 20 }; 21 22 int main() 23 { 24 Student stu(97001,"Lin Lin",'F',19); 25 26 return 0; 27 }