Problème fonction de calcul
Bonsoir j'ai un petit problème voila ce qui m'affiche mon programme
http://img192.imageshack.us/img192/8027/photoyg.jpg
Code:
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
| #include<stdio.h>
#include<conio.h>
float calcule(int,int,char);
float calcule(int a,int b,char choix){
float resultat;
switch(choix){
case 1:'+';
resultat=a+b;
case 2:'-';
resultat=a-b;
case 3:'*';
resultat=a*b;
case 4: '/';
resultat=a/b;
}
return resultat;
}
main(){
float r;
int x,y;
char s;
printf("entrez le 1er nombre \t");
scanf("%d",&x);
printf("entrez le 2eme nombre \t");
scanf("%d",&y);
printf("entrez votre choix \t");
scanf("%s",&s);
r= calcule(x,y,s);
printf("le resultat est %d",r);
getch();
} |