Witam, mam taki program, do vektora wczytuje liczby i chce je posegregować, jednak pokazuje mi błędy.
#include<iostream>
#include<fstream>
#include<algorithm>
#include<vector>
using namespace std;
bool sortuj(const vector<int>& el1, const vector<int>& el2) {
return el1 < el2;
}
int main() {
fstream file;
file.open("plik.txt", ios::in);
vector<int> vec;
if (file.is_open()) {
while (!file.eof()) {
int tmp;
file >> tmp;
vec.push_back(tmp);
}
cout << "przed sortowaniem";
for (auto it = vec.begin(); it!=vec.end(); it++) {
cout << *it << " ";
}
sort(vec.begin(), vec.end(), sortuj);
cout << "po sortowaniu";
for (auto it = vec.begin(); it != vec.end(); it++) {
cout << *it << " ";
}
file.close();
}
else {
cout << "blad odczytu";
}
}
błędy: Błąd C2664 „bool (std::vector<int,std::allocator<_Ty>> &,std::vector<_Ty,std::allocator<_Ty>> &)”: nie można dokonać konwersji argumentu 2 z „int” do „std::vector<int,std::allocator<_Ty>> &” 3907
w czym problem?