#include <bits/stdc++.h>
using namespace std;
#define x first
#define y second
map<int, int> a;
map<pair<int, int>, int > b;
map<int, pair<int, int> > c;
int main()
{
for (int i = 1; i <= 3; i ++ )
{
a[i] = i;
b[{i, i}] = i + 3;
c[i] = {i + 6, i + 6};
}
cout << 'a' << endl;//char型字符a
for (auto p : a)
{
cout << p.x << ' ' << p.y << endl;//空格' '
}
cout << 'b' << endl;
for (auto p : b)
{
cout << p.x.x << ' ' << p.x.y << ' ' << p.y << endl;
}
cout << 'c' << endl;
for (auto p : c)
{
cout << p.x << ' ' << p.y.x << ' ' << p.y.y;
puts("");//换行
}
}
总结:用map读入的话,p.x, p.y,甚至p.x.x, p.x.y ,都行,换行可以endl 可以puts("");