1. 有不确定多少组的测试数据
链接:https://www.cnblogs.com/chuyds/p/10625037.html
#include<bits/stdc++.h>
using namespace std;
int main()
{
int n;
while(cin >> n)
{
cout << n << endl;
}
return 0;
}
2、int转string
#include<string>
string str = std::to_string(i*i);
- 变长数组定义
int len;
cin>>len;
//用指针p指向new动态分配的长度为len*sizeof(int)的内存空间
int *p=new int[len];