Besoin d'aide langage c

Fermé
bibliomax Messages postés 30 Date d'inscription mercredi 15 octobre 2008 Statut Membre Dernière intervention 23 janvier 2010 - 12 janv. 2009 à 13:32
Char Snipeur Messages postés 9813 Date d'inscription vendredi 23 avril 2004 Statut Contributeur Dernière intervention 3 octobre 2023 - 12 janv. 2009 à 14:08
Bonjour,
svp aider moi a detecter l'erreur dans cet exercice le programme s'exécute mais comme d'habitude le resultat est erroné...

#include<stdio.h>

char lecturechar(){
char x;
getchar();
while(x!='R' && x!= 'V' && x!='T'){
printf(" veuillez preciser le type d'opération :");
scanf("%c",&x);
}
return x;
}

void boss(float mt,float a ,float b ,float c){
char y;
a=0;b=0;c=0;
printf(" entrer le montant de l'operation :");
scanf("%f",&mt);
y=lecturechar();
if(y=='V') a=a+mt;
else if(y=='R') b=b+mt;
else if(y=='T') c=c+mt;
}
char demande(){
char z;
getchar();
printf(" y-a-t'il un autre client (o / n) :");
scanf("%c",&z);
return z;
}

void total( float tR, float tV, float tT){
char k;
float mt,v,r,t;
do{


boss(mt,v=0,r=0,t=0);
k=demande();
}
while(k=='o');
if(k=='n'){
tR=v;
tV=r;
tT=t;

}
}

void main(){
float rtr,vrs,trs ;
total(rtr,vrs,trs);

printf(" le total retiré est =%f\n",rtr);
printf(" le total versé est =%f\n",vrs);
printf(" le total transfere est =%f\n",trs);
}

merci d'avance
A voir également:

1 réponse

Char Snipeur Messages postés 9813 Date d'inscription vendredi 23 avril 2004 Statut Contributeur Dernière intervention 3 octobre 2023 1 297
12 janv. 2009 à 14:08
la procedure boss() ne fait rien !
Ou plus précisément, tout ce qu'elle fait est perdu.
1