我的目的是输入任意多的数字,然后通过排序算法,最后输出最大的值
目前搞不懂要怎么才可以向一个容器中无限的放入数据,这个程序运行会崩溃
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
void test()
{
vector<int>val;
val.resize(1000);
int put;
while (cin >> put)
{
val.push_back(put);
}
sort(val.begin(), val.end());
cout << *val.end() << endl;
}
int main()
{
test();
system("pause");
return 0;
}