#include <iostream>
#include <string>
#include <vector>
using namespace std;
void main()
{
//利用vector给动态数组赋值
vector<int> iv;
int maxcnt;
cout << "请输入元素数量:";
cin >> maxcnt;
int temp;
while (cin >> temp)
{
iv.push_back(temp);
if (iv.size() == maxcnt)
break;
}
int *p = new int[iv.size()];
for (size_t ix = 0; ix != iv.size(); ++ix)
{
*(p + ix) = iv[ix];
cout << *(p + ix);
}
delete[]p;
system("pause");
}
#include <iostream>
#include <string>
#include