1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
| #include<iostream> #include<cstring> using namespace std; struct people { people(int t_age,double t_weight,double t_tall,string t_name,string t_native,bool t_sex); int age; double weight; double tall; string name; string native; bool sex; }; void check(bool s){if(s==1)cout<<"男"<<endl;else cout<<"女"<<endl;} int main() { people Jack(34,170.3,180.5,"Jack","济南",1); cout<<Jack.name<<endl; cout<<Jack.native<<endl; cout<<Jack.tall<<endl; cout<<Jack.weight<<endl; cout<<Jack.age<<endl; check(Jack.sex);
return 0; } people::people(int t_age,double t_weight,double t_tall,string t_name,string t_native,bool t_sex){ age=t_age; weight=t_weight; tall=t_tall; name=t_name; native=t_native; sex=t_sex; }
|