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
|
#include <iostream>
using namespace std;
struct produit
{
char code[10];
char title[100];
};
void nvxprd(produit &prd,int &in)
{
cout << "Entrez le code du produit: ";
cin.getline(prd.code,10);
cout << "Entrer l\'intitule du produit: ";
cin.getline(prd.title,100);
in++;
}
int main()
{
bool flag = true;
int choix=0,nb=0;
produit liste[10];
while(flag)
{
cout << "1. Ajouter un produit\n"
"6. Quitter\n"
"Votre choix: ";
cin >> choix;
switch(choix)
{
case 1:
nvxprd(liste[nb],nb);
break;
case 6:
flag = false;
default:
cout << "Commande incorrect !\n";
break;
}
}
return 0;
} |
Partager