I want to do is basically writing a function which takes a parameter as a file name and if have multiple files, it will just take file name as a parameter and it should do this repetitively with a function. How can i do this? Thanks.
Txt files are like this for example, sorular.txt:
//What is the most crowded country in the world?
//China
//USA
//Germany
//Australia
//China
int main (){
    string array [5];
    string line;
    string answer;
    static int trueCount = 0;
    static int falseCount = 0;
    ifstream file("/Users/User/QuizMaker/Quiz Maker V2/sorular.txt");
    if(file.is_open()){
        cout << "Questions are loading... Please wait.."<<endl<<" ."<<endl<<" ."<<endl<<" ."<<endl;
        while (!file.eof()) {
            for (int i = 0; i<6; i++) {
                getline(file,array[i]);
            }
            for (int a = 0; a<5; a++) {
                  cout << array[a] << endl;
            }
            cin >> answer;
            if(answer == "C" || answer == "c") {
                cout << true;
                trueCount++;
            }
            else falseCount++;
        }
        cout << "You answered "<<trueCount << " questions as true" << endl;
        cout << "You answered "<<falseCount << " questions as false" << endl;
        file.close();
    } else cout << " not ıoen";
    cin.get();
    return 0;
}
 
    