vendredi 23 mars 2018

Output vector array into tex file, error [duplicate]

This question already has an answer here:

I'm trying to output the values of a vector array into a text but im getting this weird error

no opeartor "<<" matches the operands, operand types are : std::ofstream << Person

Here is my code

    ofstream myfile;
    myfile.open("test.txt");

    vector <Person> persons;


    string N, F;
    int A;
    while (cin >> N >> F >> A) {

        Person tmpPerson(N, F, A);

        persons.push_back(tmpPerson);

        for (int i = 0; i < persons.size(); i++){
            myfile << persons[i] << " " << endl;
        }
        myfile.close();

    };

I have incuded the and tried everything, but this error, persist, would be very thankful for some help !

Aucun commentaire:

Enregistrer un commentaire