#include <iostream> #include <string> using std::cout; using std::cin; using std::endl; using std::string; struct profile { string name; int gender; //0:男, 1:女, 2:その他 int age; float height; string job; }; void printProfile(profile _dat) { //if(_dat.gender == 0) cout << "男" << endl; //else if(_dat.gender == 1)cout << "女" << endl; //else cout << "その他" << endl; string gen[3] = {"男", "女", "その他"}; cout << "=+=+=+=+=+ profile =+=+=+=+=+" << endl; cout << "名前:" << _dat.name << endl; cout << "性別:" << gen[_dat.gender] << endl; cout << "年齢:" << _dat.age << endl; cout << "身長:" << _dat.height << endl; cout << "職業:" << _dat.job << endl; cout << "=+=+=+=+=+ end data =+=+=+=+=+" << endl; } int main() { const int member_num = 5; profile member[member_num] = { {"佐藤", 0, 35, 164, "漁師"}, {"鈴木", 1, 21, 153, "CA" }, {"佐々木", 1, 15, 163, "カジノディーラー"}, {"吉田", 0, 56, 175, "霊媒師"}, {"古川", 0, 38, 169, "鳥の調教師"}}; for(auto i=0; i<member_num; i++) { printProfile(member[i]); } }