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 86 87 88 89 90 91
|
code=getchar();
while(code!='c')
{
switch(code)//debut du switch
{
case'a':
case'A': //arrivage d un lot de poisson
{
//system ("cls"); // nettoie l ecran
printf("\nVeuillez saisir le nom du lot:\n");
fflush(stdin);
gets(lot);
for (i=0;i<nblot &&strcmp(lot,Tfish[i].lot)!=0;i+=1);
if (i<nblot)
{
printf("\nLOT DEJA ENREGISTRE: %s\n\n",lot);
}
else
{
strcpy(Tfish[i].lot,lot);
printf("\nVeuillez saisir le prix de la mise en vente:\n");
scanf("%5d",&Tfish[i].prix);
strcpy(Tfish[i].ach,"*");
nblot+=1;
printf("\nARRIVAGE:\nlot: %-20s prix: %d\n\n",lot,Tfish[i].prix);
system("pause");
}
}
break;//fin du case 'a' ou 'A'
case'P':
case'p': //Proposition de prix d un acheteur
{
system ("cls");
if (nblot==0)
{
printf("\nAUCUN LOT\n\n\n",lot);
system("pause");
}
else
{
int p=0;
printf("\nVeuillez saisir le nom du lot:\n");
fflush(stdin);
gets(lot);
for (i=0;i<nblot && strcmp(lot,Tfish[i].lot)!=0;i+=1);
if (i<nblot)
{
printf("\nVeuillez proposer le prix d'achat:\n");
scanf("%d",&p);
if (Tfish[i].prix>=p)
{
printf("\nPRIX MAINTENU\nnom du lot: %20s prix: %5d\n",Tfish[i].lot,Tfish[i].prix);
system("pause");
}
else
{
Tfish[i].prix=p;
printf("\nVeuillez saisir le nom de l acheteur:\n");
fflush(stdin);
gets(ach);
strcpy(Tfish[i].ach,ach);
printf("\nNOUVEAUX PRIX\nnom du lot: %20s, prix: %5d\n",Tfish[i].lot,p);
system("pause");
}
}
else
{
printf("\nLOT INCONNU: %s\n\n\n",lot);
system("pause");
}
}
}
break;//fin du case 'p' ou 'P'
default :
{
system ("cls"); // nettoie l ecran
printf("\nCODE INVALIDE, la saisie est incorrecte\n\n\n");
}
}//fin du switch
printf ("* RAPPEL *\n\n");
printf ("A - Arrivage d'un lot de poisson\n\n");
printf ("P - Proposition de prix d'un acheteur\n\n");
printf ("L - Liste des lots\n\n");
printf ("C - Cloture de cette vente aux encheres\n\n\n\n\n");
printf ("VEUILLEZ RESAISIR LA LETTRE CORRESPONDANT\n A L'EVENEMENT SOUHAITE ET CLIQUER SUR ENTRER: \n\n\n");
code=getchar();
}// fin du while |
Partager