bonour
je veux remplire un tableau dynamique d obet de la classe Nation mais j ai l erreur
error C2679: binary '=' : no operator defined which takes a right-hand operand of type 'class Nation *' (or there is no acceptable conversion)
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23 void lireRemplir (char *nomFichier, Nation pays [], int &n ){ n = 0; // initialiser le tableau des nations ifstream aLire(nomFichier, ios::in); // ouvrir le fichier pour la lecture string ligne; while( getline(aLire, ligne, '\n')){ char nouvContinent = ligne.at(0); string nouvNom = ligne.substr(1, LONG_NOM); string nouvCapitale = ligne.substr(36, LONG_CAP); int nouvSuperficie = atoi(ligne.substr(56,10).c_str()); int nouvPopulation = atoi(ligne.substr(66).c_str()); pays[n++] = new Nation(nouvNom, nouvCapitale, nouvContinent, nouvSuperficie, nouvPopulation); }
Partager