1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
|
class boutique {
float argent;
int nb_element;
vector<int> quantity;
vector<float> prix;
vector<string> name;
friend std::ostream& operator <<(std::ostream&, const boutique&);
public:
friend std::ostream& operator <<(std::ostream& Stream, const boutique& Obj) {
Stream << Obj.argent;
return Stream;
}
}
//...
void main(void) {
boutique var;
int chx, nb, id;
float val;
string name;
while (1) {
system("cls");
cout << "selectionnez ce que vous voulez faire" << endl << endl
<< "1:gagner de l'argent" << endl
<< "2:perdre de l'argent" << endl << endl
<< "3:vendre" << endl
<< "4:acheter" << endl << endl
<< "5:stocks" << endl
<< "6:argent total" << endl << endl
<< "7:Nouveau produit" << endl << endl
<< "8:Enregistrer" << endl
<< "9:Ouvrir" << endl << endl;
cin >> chx;
switch (chx) {
/...
case 8 :
ofstream out("fichier.txt");
//RESOLU error C2079: 'out' utilise une class de 'std::basic_ofstream<_Elem,_Traits>' non défini
//RESOLU error C2440: 'initialisation' : impossible de convertir de 'const char [12]' en 'int'
out << var << endl;
//RESOLU error C2678: '<<' binaire : aucun opérateur trouvé qui accepte un opérande de partie gauche de type 'int' (ou il n'existe pas de conversion acceptable)
break;
default : cout << "Erreur";
///////////////////////////////////////////////////////
//PAS RESOLU error C2361: l'initialisation de 'out' est ignorée par l'étiquette 'default'
///////////////////////////////////////////////////////
//... |
Partager