C++ 标识符';排序';是未定义的c++; #包括 #包括 #包括 #包括 #包括 #包括 #包括 #包括 #包括 使用名称空间std; 向量randVect(整数数量、整数最小值、整数最大值); int main(int argc,字符**argv) { 向量值=随机向量(10,1,50); 排序(values.begin(),values.end(),[](int x,int y){return x
您应该包含标题C++ 标识符';排序';是未定义的c++; #包括 #包括 #包括 #包括 #包括 #包括 #包括 #包括 #包括 使用名称空间std; 向量randVect(整数数量、整数最小值、整数最大值); int main(int argc,字符**argv) { 向量值=随机向量(10,1,50); 排序(values.begin(),values.end(),[](int x,int y){return x,c++,C++,您应该包含标题#包含那里定义的排序算法。? #include <cstdlib> #include <iostream> #include <limits> #include <sstream> #include <numeric> #include <ctime> #include <cmath> #include <vector> #include <cstdlib> using n
#包含那里定义的排序算法。?
#include <cstdlib>
#include <iostream>
#include <limits>
#include <sstream>
#include <numeric>
#include <ctime>
#include <cmath>
#include <vector>
#include <cstdlib>
using namespace std;
vector<int> randVect(int amount, int min, int max);
int main(int argc, char** argv)
{
vector<int> values = randVect(10, 1, 50);
sort(values.begin(), values.end(), [](int x, int y){return x < y;});
for (auto val: values){
cout << val << endl;
}
return 0;
};
vector<int> randVect(int amount, int min, int max){
vector<int> vecVals;
srand(time(NULL));
int i = 0, randVal = 0;
while(i < amount){
randVal = min + rand() % ((max + 1) - min);
vecVals.push_back(randVal);
i++;
}
return vecVals;
}