0

Let's say I've got a txt file with mutiple line exemple:

jeremy(thats the name) 0952966(thats the id) 5(nb of grades) 10 20 12 (grades)

the question is how to isolated each things like the name the id and the grade into some attributes. When I read the file I can isolated some of the things with getLine but I cannot store it properly into attributes or a container.

Thank you

here's what my student class looks like right now:

#ifndef ETUDIANT_H
#define ETUDIANT_H

#include <string>
#include <vector>

using namespace std;

class Etudiant {


private:
    Etudiant(string un_nom, long un_id);

    string nom;
    long id;
    int nb_note;
    vector<int> notes;
public:
    Etudiant(string n, string i, int nb) {
        nom = n;
        id = i;
        nb_note = nb
    }
    Etudiant() {
        nom = "";
        id = "";
        nb_note = "";
    }
    string obtenirNom() { return nom; }

    long obtenirId() { return id; }

    int obtenirNbNote() { return nb_note; }

    void ajoutNote(int note) {
        notes.push_back(note);
    }
};

#endif
Retired Ninja
  • 4,785
  • 3
  • 25
  • 35

0 Answers0