Advertisement
pierrick_durand

Untitled

Nov 24th, 2015
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.19 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <math.h>
  4. #define Pi 3.14
  5. int recommencer = 1;
  6. int affichageMenu(void)
  7. {
  8.     int choixMenu;
  9.  
  10.     printf("Bonjour et bienvenue sur ce programme permettant de faire des calculs! \n");
  11.     getchar();
  12.     while (recommencer == 1);
  13.     printf("Choisissez quel type de calcul vous voulez effectuer en saisissant le nombre correspondant.\n");
  14.     printf("calcul simple tapez 1.\n");
  15.     printf("calcul de surface tapez 2.\n");
  16.     printf("convertion de longeur tapez 3.\n");
  17.     printf("quitter le programme tapez 4.\n");
  18.     scanf("%d", &choixMenu);
  19.     return choixMenu;
  20.     }
  21.  
  22. int main (void)
  23. {
  24.         float V1;
  25.         float V2;
  26.         float V3;
  27.         float L ;
  28.         float l ;
  29.         float S ;
  30.         float R ;
  31.         float P ;
  32.         int choixcalculsimple ;
  33.         int choixsurface ;
  34.         int choixtriangle ;
  35.         int choixconvertion;
  36.     switch (affichageMenu())
  37.     {
  38.     case 1:
  39.  
  40.         printf("vous avez choisi le calcul simple\n");
  41.         printf("Pour faire une addition tpez 1.\n");
  42.         printf("Pour faire une soustraction tapez 2.\n");
  43.         printf("Pour faire une multiplication tapez 3.\n");
  44.         printf("Pour faire une division tapez 4.\n");
  45.         scanf("%d", &choixcalculsimple);
  46.         switch(choixcalculsimple )
  47.         {
  48.  
  49.  
  50.                      case 1:
  51.                         printf("Vous avez choisi de faire une addition.\n");
  52.                         printf("veuillez entrer la premiere valeur.\n");
  53.                         scanf("%f", &V1);
  54.                         printf("veuillez entrer la deuxieme valeur.\n");
  55.                         scanf("%f", &V2);
  56.                         V3 = V1 + V2 ;
  57.                         printf("le resultat de l'addition est %f\n",V3);
  58.  
  59.                         do
  60.                         {
  61.                             printf("Voulez vous recommencer?\n");
  62.                             printf("Si oui tapez 1.\n");
  63.                             printf("Si non tapez 2.\n");
  64.                             scanf("%d",&recommencer);
  65.                         }
  66.                          while (recommencer !=0 || recommencer !=1);
  67.                         break;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement