Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- ecrire une procedure permettant de réaliser une venete dans cette procedure on saisie le numero de vehcule n affiche ses infrmations et n saisie la quantite vendue
- */
- #include<stdio.h>
- #include<conio.h>
- #include<string.h>
- #include<stdlib.h>
- typedef struct {
- int num;
- int prix;
- int quantit;
- char marque[10];
- char categorie[15];
- char appr[4];
- }vehicule;
- vehicule v[2];
- void menu(){
- printf("\t\t ****Gestion de Stock de véhicule****\n");
- printf("\t\t\t *==Menu==*\n");
- printf("\t 1\t Afficher Les vehicule \n");
- printf("\t 2\t Vendre Un vehicule \n");
- printf("\t 3\t Afficher Les vehicule par Catégorie \n");
- printf("\t 4\t Quitter \n");
- printf("Entrez votre choix:\n\n");
- }
- void creerVehicule(){
- int i;
- char m[3];
- for(i=0;i<50;i++){
- v[i].num=(i+1)*10;
- if(i<20)
- strcpy(v[i].categorie,"Familiale");
- else if(i>=20&&i<40)
- strcpy(v[i].categorie,"Utilitaire");
- else
- strcpy(v[i].categorie,"sport");
- strcpy(v[i].marque,"M");
- itoa(i+1,m,10); //convertion d'un entier vers une chaine
- strcat(v[i].marque,m);
- v[i].prix=10+rand()%90;
- v[i].quantit=10;
- strcpy(v[i].appr,"Non");
- }
- }
- void afficher (){
- int i;
- printf("N\tmarque\tcategorie\tprix\tquntite\tappr\n");
- printf("-----------------------------------------------------\n");
- for(i=0;i<50;i++)
- printf("%-3d\t%-3s\t%-10s\t%-2d\t%-2d\t%-3s\n",v[i].num,v[i].marque,v[i].categorie,v[i].prix,v[i].quantit,v[i].appr);
- }
- void vendre(){
- }
- main(){
- int choix;
- creerVehicule();
- do{
- menu();
- scanf("%d",&choix);
- system("cls");
- switch(choix){
- case 1: afficher ();
- break;
- case 2:
- break;
- case 3:
- break;
- case 4:exit(1);
- default : printf("Ce choix n'existe pas\n");
- }
- getch();
- system("cls");
- }while(choix!=4);
- }
Advertisement
Add Comment
Please, Sign In to add comment