Langage c ++

2011991 -  
arthurik Messages postés 166 Date d'inscription   Statut Membre Dernière intervention   -
Ecrire un programme qui saisi 20 entier >0 et affiche le minimum et le maximum de cet entier
A voir également:

2 réponses

Pacorabanix Messages postés 3248 Date d'inscription   Statut Membre Dernière intervention   663
 
0
arthurik Messages postés 166 Date d'inscription   Statut Membre Dernière intervention   14
 
Salut c'est une petite méthode.

#include <cstdlib>
#include <iostream>

using namespace std;

int main(int argc, char *argv[])
{
int min = 0, max = 0, nombre = 0,i = 0;

while(i < 20)
{
cout << "Tappez un nombre : ";
cin >> nombre;
while(nombre <= 0)
{
cout << "Ignore, Tappez un nombre plus grand que 0 : ";
cin >> nombre;
}
if(nombre > max)
max = nombre;
if(nombre < min)
min = nombre;
}

system("PAUSE");
return EXIT_SUCCESS;
}
0