samedi 4 avril 2020

Using arrays to read and write from fstream?

MAXSIZE set to 100, first menu option is supposed to check if there is size in the array, read from file and write to first slot of title[] array. I am quite lost.

switch (menu)
        {
            case 1:
                while (getline(infile) < MAXSIZE)
                void readMovies(ifstream &infile, int year[], string title[], int &size){
                        string tmp_title;
                        int tmp_year;
                        while (getline(infile, tmp_title)
                        {
                            infile >> tmp_year;
                            infile.ignore();
                            year [size] = tmp_year;
                            title[size] = tmp_title;
                            size++;
                        }
        break;}

Aucun commentaire:

Enregistrer un commentaire