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 48 49 50
| #include <iostream>
#include <string>
using namespace std;
class Article
{
public:
string nom;
int code;
int quantite;
int prix;
int cmpArticle (Article a1, Article a2);
Article(string a, int b, int c, int d)
{
nom=a;
code=b;
quantite=c;
prix=d;
}
int isEqualcode(Article a1, Article a2);
{
int code1;
int code2;
int code1(Article a1.code);
int code2(Article a2.code);
return a1.code.cmpArticle(a2.name);
}
};
int main()
{
Article a1("lait", 15, 14, 50) ;
cout << "constructeur par defaut" << endl;
cout << "nom=" << a1.nom << endl;
cout << "code=" << a1.code << endl;
cout << "quantite=" << a1.quantite << endl;
cout << "prix=" << a1.prix << endl;
cout << " " << endl;
Article a2("lait", 15, 14, 50) ;
cout << " constructeur initialisant" << endl;
cout << "nom=" << a2.nom << endl ;
cout << "code=" << a2.code << endl;
cout << "quantite=" << a2.quantite << endl;
cout << "prix=" << a2.prix << endl;
return 0;
} |
Partager