预期的主要表达是“输入”

时间:2017-12-14 18:07:04

标签: c++

我想“快速排序”我从.txt文件中读取的数组;但代码生成错误。它说"Expected primary expression before "input" "

感谢任何帮助。这是代码。谢谢。

#include <iostream>
#include <fstream>
#include <vector>

using namespace std;
void quickSort(int tabele[], int majtas, int djathtas){
    if(majtas<djathtas){
        int vendPivot = ndarja(tabele, majtas, djathtas);
        /* rendit sipas rradhes elementet para dhe pas vendPivot */
        quickSort(tabele, majtas,vendPivot-1);
        quickSort(tabele,vendPivot+1, djathtas);
    }

}    
vector<int> lexoTabele(){
    vector<int> data;

    ifstream inFile;
    inFile.open("detyraekursit.txt");
    if (!inFile.is_open()) {
        cout << "Unable to open file";
        exit(1); // terminate with error
    }

    int x;

    cout<<"Vektori INPUT para renditjes ";
    while (inFile >> x) {
        data.push_back(x);
    }
    inFile.close();

    return data;
}

int main() {  
    vector<int> input = lexoTabele();
    int x,y;
    for(int i = 0;i < input.size();i++) {
        cout<< i << ", " << input[i];
    }
    quickSort(vector<int>input,x,y);
    return 0;
}

0 个答案:

没有答案