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 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
| void ObtenirInfosProduit (int p_codeVecteur, string p_code,
vector<TypeProduit>& p_s_produit)
{
p_s_produit[p_codeVecteur].code= p_code;
cout << "Veuillez entrer le nom du nouveau produit? ";
getline(cin, p_s_produit[p_codeVecteur].nom);
do
{
cout << "Choisisez le catégorie de ce produit? "
<< "(biscuits, boisson, chocolat, croustilles, fruit, gâteau ou autre)";
string catégorie;
cin >> catégorie;
cin.ignore();
if (catégorie == "biscuits")
p_s_produit[p_codeVecteur].catégorie= BISCUITS;
else
if (catégorie == "boisson")
p_s_produit[p_codeVecteur].catégorie= BOISSON;
else
if (catégorie == "chocolat")
p_s_produit[p_codeVecteur].catégorie= CHOCOLAT;
else
if (catégorie == "croustilles")
p_s_produit[p_codeVecteur].catégorie= CROUSTILLES;
else
if (catégorie == "fruits")
p_s_produit[p_codeVecteur].catégorie= FRUIT;
else
if (catégorie == "gâteau")
p_s_produit[p_codeVecteur].catégorie= GÂTEAU;
else
if (catégorie == "autre")
p_s_produit[p_codeVecteur].catégorie= AUTRE;
}
while (p_s_produit[p_codeVecteur].catégorie != BISCUITS &&
p_s_produit[p_codeVecteur].catégorie != BOISSON &&
p_s_produit[p_codeVecteur].catégorie != CHOCOLAT &&
p_s_produit[p_codeVecteur].catégorie != CROUSTILLES &&
p_s_produit[p_codeVecteur].catégorie != FRUIT &&
p_s_produit[p_codeVecteur].catégorie != GÂTEAU &&
p_s_produit[p_codeVecteur].catégorie != AUTRE);
if (p_s_produit[p_codeVecteur].catégorie == AUTRE)
{
do
{
cout << "Quelles taxes(TPS, TVQ, TPS&TVQ, AUCUNE) s'appliquent\n"
<< "à ce produit? ";
string taxe;
cin >> taxe;
cin.ignore();
if (taxe == "TPS")
p_s_produit[p_codeVecteur].taxe= TPS;
else
if (taxe == "TVQ")
p_s_produit[p_codeVecteur].taxe= TVQ;
else
if (taxe == "TPS&TVQ")
p_s_produit[p_codeVecteur].taxe= TPSETTVQ;
else
if (taxe == "AUCUNE")
p_s_produit[p_codeVecteur].taxe= AUCUNE;
else
cout << "Veuillez écrire le type de taxe en MAJUSCULE\n";
}
while (p_s_produit[p_codeVecteur].taxe != TPS &&
p_s_produit[p_codeVecteur].taxe != TVQ &&
p_s_produit[p_codeVecteur].taxe != TPSETTVQ &&
p_s_produit[p_codeVecteur].taxe != AUCUNE);
}
else
{
switch (p_s_produit[p_codeVecteur].catégorie)
{
case BISCUITS :
case BOISSON :
case CHOCOLAT :
case CROUSTILLES :
case GÂTEAU : p_s_produit[p_codeVecteur].taxe= TPSETTVQ; break;
case FRUIT : p_s_produit[p_codeVecteur].taxe= AUCUNE; break;
default : assert(false);
}
} |
Partager