bouchnina

Untitled

Mar 21st, 2013
44
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.67 KB | None | 0 0
  1. /*
  2. 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
  3. */
  4. #include<stdio.h>
  5. #include<conio.h>
  6. #include<string.h>
  7. #include<stdlib.h>
  8. typedef struct {
  9. int num;
  10. int prix;
  11. int quantit;
  12. char marque[10];
  13. char categorie[15];
  14. char appr[4];
  15. }vehicule;
  16. vehicule v[2];
  17. void menu(){
  18. printf("\t\t ****Gestion de Stock de véhicule****\n");
  19. printf("\t\t\t *==Menu==*\n");
  20. printf("\t 1\t Afficher Les vehicule \n");
  21. printf("\t 2\t Vendre Un vehicule \n");
  22. printf("\t 3\t Afficher Les vehicule par Catégorie \n");
  23. printf("\t 4\t Quitter \n");
  24. printf("Entrez votre choix:\n\n");
  25. }
  26.  
  27. void creerVehicule(){
  28. int i;
  29. char m[3];
  30. for(i=0;i<50;i++){
  31. v[i].num=(i+1)*10;
  32. if(i<20)
  33. strcpy(v[i].categorie,"Familiale");
  34. else if(i>=20&&i<40)
  35. strcpy(v[i].categorie,"Utilitaire");
  36. else
  37. strcpy(v[i].categorie,"sport");
  38. strcpy(v[i].marque,"M");
  39. itoa(i+1,m,10); //convertion d'un entier vers une chaine
  40. strcat(v[i].marque,m);
  41. v[i].prix=10+rand()%90;
  42. v[i].quantit=10;
  43. strcpy(v[i].appr,"Non");
  44. }
  45. }
  46. void afficher (){
  47. int i;
  48. printf("N\tmarque\tcategorie\tprix\tquntite\tappr\n");
  49. printf("-----------------------------------------------------\n");
  50. for(i=0;i<50;i++)
  51. 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);
  52. }
  53. void vendre(){
  54.  
  55. }
  56. main(){
  57. int choix;
  58. creerVehicule();
  59. do{
  60. menu();
  61. scanf("%d",&choix);
  62. system("cls");
  63. switch(choix){
  64. case 1: afficher ();
  65. break;
  66. case 2:
  67. break;
  68. case 3:
  69. break;
  70. case 4:exit(1);
  71. default : printf("Ce choix n'existe pas\n");
  72. }
  73. getch();
  74. system("cls");
  75. }while(choix!=4);
  76. }
Advertisement
Add Comment
Please, Sign In to add comment