#include<iostream>
using namespace std;
#include<string>
//结构体数组

struct student 
{
    string name;
    int age;
    float score;
};

int main()
{
    struct student studentArr[3] =
    {
        {"张三",18,97.5},
        {"李四",19,60},
        {"王五",17,78},
    };

    studentArr[1].score = 85.5;

    for (int i = 0; i < 3; i++) 
    {
        cout << "姓名: " << studentArr[i].name <<"  "
             << "年龄: " << studentArr[i].age <<"  "
             << "分数: " << studentArr[i].score<<"  " << endl;
    }
    system("pause");
    return 0;

}

 

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-06
  • 2022-12-23
  • 2021-06-05
  • 2022-12-23
  • 2022-01-03
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-01-04
  • 2021-09-02
  • 2022-12-23
相关资源
相似解决方案