I am new to C++ and was trying to sort a vector using inbuilt function on jobsCompleted.end()
#include<bits/stdc++.h>
using namespace std;
int main(){
vector<int> jobsCompleted(10);
for(int j=0;j<10;j++){
cin>>jobsCompleted[j];
}
jobsCompleted = sort(jobsCompleted.begin(), jobsCompleted.end());
return 0;
}
Compiling as: g++ -std=c++11 sort.cpp
Error it gives is as follows:
sort.cpp:10:68: error: no match for 'operator=' (operand types are 'std::vector' and 'void') jobsCompleted = sort(jobsCompleted.begin(), jobsCompleted.end());
Aucun commentaire:
Enregistrer un commentaire