Programation c++ besoin d'aide (débutant)

Résolu/Fermé
bibliomax Messages postés 30 Date d'inscription mercredi 15 octobre 2008 Statut Membre Dernière intervention 23 janvier 2010 - 2 nov. 2008 à 17:54
bibliomax Messages postés 30 Date d'inscription mercredi 15 octobre 2008 Statut Membre Dernière intervention 23 janvier 2010 - 4 nov. 2008 à 01:09
Bonjour,
ecrire un programme qui lit 3 réels au clavier . ensuite il demande à l'utilisateur s'il veut calculer le minimum ou le maximum. si la réponse est 'a' ou 'A' , il affiche le maximum et si la réponse est ' i ' ou 'I ' il calcul et affiche le minimum si la réponse et différente le programme affiche " réponse incorrecte"

3 réponses

cchristian Messages postés 921 Date d'inscription lundi 21 janvier 2008 Statut Membre Dernière intervention 6 mars 2012 131
2 nov. 2008 à 18:18
Bonsoir,

NON , les gars, faut se bouger un peu, faites au moins un début d'embryon de commencement de quelque chose. Que l'on ait pas l'impression d'être pris pour des bourricots.
0
Jidoune Messages postés 112 Date d'inscription samedi 21 juin 2008 Statut Membre Dernière intervention 16 octobre 2013 9
2 nov. 2008 à 20:54
as-tu fais un pseudo-code (plan du logicielle ), sinon ceci va pouvoir t'aider.
Puis, pour tes valeur en maj trouve toi un autre moyen, parce que sa va te compliquer.
0
cchristian Messages postés 921 Date d'inscription lundi 21 janvier 2008 Statut Membre Dernière intervention 6 mars 2012 131
3 nov. 2008 à 11:40
Bonjour,


int main()
{
        float rep_clav            = -1                          ;
        float val_min             = 999999999                   ; 
        float val_max             = -999999999                  ; 
        char  rep_clav_choix      = '\0'                        ;
        int   I                   = 0                           ;
        char  enieme     []       = "iere"                      ;
 const int nb_val                  = 3                                   ;
        float tab_val [nb_val]                                  ;

 system ("CLS");
 for ( I = 0;  I < nb_val;  I++ )
    {
      printf("\n entrez une %i%s valeur : ", I + 1, enieme)   ;
      scanf   ("%f", &rep_clav)                               ;
      tab_val [I]  =  rep_clav                                ;
      strcpy ( enieme , "ieme" )                              ;
    }
// Pour test contrôle visuel :
 for ( I = 0;  I < nb_val;  I++ )
    { printf("\n tab_val %i% = %f", I, tab_val [I]  )     ;}
// Fin contrôle visuel;

 do
   {
     printf("\n Pour determiner le minimum tapez I, A pour le"
              " maximum, X = fin. ")                            ;
      rep_clav_choix              = _getch ()                  ;
      _strupr	 (&rep_clav_choix,	100)  ;

     if ( rep_clav_choix == 'I' )
       {  for ( I = 0;  I < nb_val;  I++ )
           {  if ( tab_val [I]  <  val_min)
                {  val_min      =  tab_val [I]              ;}
           }
          printf ("\n Valeur minimale : %f", val_min)         ;
       }
     else
       {
         if ( rep_clav_choix == 'A' )
           {  for ( I = 0;  I < nb_val;  I++ )
                  {  if ( tab_val [I]  >  val_max)
	       {  val_max      =  tab_val [I]          ;}
                   }
             printf ("\n Valeur maximale : %f", val_max)      ;
            }
         else
           {
              if ( rep_clav_choix != 'X')
               {
	 printf ("\n choix: %c incoherent.",rep_clav_choix);}
             }
	   }
     } while ( rep_clav_choix != 'X');
return 0;
}
0
bibliomax Messages postés 30 Date d'inscription mercredi 15 octobre 2008 Statut Membre Dernière intervention 23 janvier 2010 3
4 nov. 2008 à 00:58
ça n'a pas marcher
j'ai écris autre chose mais y'a une erreur (c 2296 '&' illegal left operand has type 'char [5] ' ) que dois je faire?


#include <stdio.h>
void main() {
float x,y,z;
char a,i,r;
printf(" entrer les 3 reels :");
scanf("%f",&x);
scanf("%f",&y);
scanf("%f",&z);
printf("x=%.2f\n,y=%.2f\n,z=%.2f",x,y,z);
printf(" vous vooulez le maximum ou le minimum ?\n ");
printf(" si reponse max tapez [a] si reponse min tapez [i] ");
getchar();
scanf("%c%c"&a,&i);
// scanf("%c" &i);


if(r=a){
if(x>y && x>z) printf(" le maximum est=%.2f\n",x);
if(y>x && y>z) printf(" le maximum est=%.2f\n",y);
if(z>x && z>y) printf(" le maximum est=%.2f\n",z);
}
if(r=i){
if(x<y && x<z) printf(" le minimum est=%.2f\n",x);
if(y<x && y<z) printf(" le minimum est=%.2f\n",y);
if(z<x && z<y) printf(" le minimum est=%.2f\n",z);
}
//if(r!(a && i)) printf(" reponse incorrecte ");
}
0
bibliomax Messages postés 30 Date d'inscription mercredi 15 octobre 2008 Statut Membre Dernière intervention 23 janvier 2010 3 > bibliomax Messages postés 30 Date d'inscription mercredi 15 octobre 2008 Statut Membre Dernière intervention 23 janvier 2010
4 nov. 2008 à 01:09
l'affaire est solutionner l3ezzzz j'ai pu resoudre le probleme
0