#include <iostream>
using namespace std;
struct students
{
char name[20];
int score;
};
int main()
{
int n;
cin >> n;
students* a = new students[n];
for (int i = 0; i < n; i++)
{
cin >> a[i].name >> a[i].score;
}
for (int i = 0; i < n; i++)
{
cout << a[i].name << " " << a[i].score << endl;
}
delete[]a;
return 0;
}
C++ 动态分配结构体数组
最新推荐文章于 2024-05-11 08:42:26 发布