#include #include #include using namespace std; struct student { string name;//名前 int age; //年齢 double height;//身長 double weight;//体重 }; /// /// 渡された学生個人のデータを表示する関数 /// /// /// 一人の学生の個人データを表す構造体型 /// void PrintStu(student _stu) { cout << "-------------------" << endl; cout << "Name: " << _stu.name << endl; cout << " Age: " << _stu.age << endl; cout << " HGT: " << _stu.height << endl; cout << " WGT: " << _stu.weight << endl; cout << "-------------------" << endl; } int main() { const int STUNUM = 5; //int arr[5] = { 1,3,5,6,8 }; student myStu[STUNUM] = { { "sato", 18, 192.0, 97.0 }, { "yamada", 20, 165.0, 48.0 }, { "suzuki", 16, 168.0, 58.0 }, { "sasaki", 32, 154.0, 70.0 }, {"yoshida", 67, 185.0, 88.0 } }; for (int i = 0; i < STUNUM; i++) { PrintStu(myStu[i]); } return 0; }