Programmation C++
Fermé
jeff88
-
11 janv. 2013 à 13:56
Dudule100 Messages postés 563 Date d'inscription jeudi 25 octobre 2012 Statut Membre Dernière intervention 22 janvier 2017 - 11 janv. 2013 à 13:59
Dudule100 Messages postés 563 Date d'inscription jeudi 25 octobre 2012 Statut Membre Dernière intervention 22 janvier 2017 - 11 janv. 2013 à 13:59
A voir également:
- Programmation C++
- Programmation - Guide
- Application de programmation - Guide
- Programmation logo tortue télécharger - Télécharger - Études & Formations
- Programmation binaire - Guide
- Logiciel algorithme programmation - Télécharger - Édition & Programmation
1 réponse
Dudule100
Messages postés
563
Date d'inscription
jeudi 25 octobre 2012
Statut
Membre
Dernière intervention
22 janvier 2017
30
11 janv. 2013 à 13:59
11 janv. 2013 à 13:59
tu tape sa :
/* rand example: guess the number */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main ()
{
int iSecret, iGuess;
/* initialize random seed: */
srand ( time(NULL) );
/* generate secret number: */
iSecret = rand() % 10 + 1;
do {
printf ("Guess the number (1 to 10): ");
scanf ("%d",&iGuess);
if (iSecret<iGuess) puts ("The secret number is lower");
else if (iSecret>iGuess) puts ("The secret number is higher");
} while (iSecret!=iGuess);
puts ("Congratulations!");
return 0;
}
/* rand example: guess the number */
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int main ()
{
int iSecret, iGuess;
/* initialize random seed: */
srand ( time(NULL) );
/* generate secret number: */
iSecret = rand() % 10 + 1;
do {
printf ("Guess the number (1 to 10): ");
scanf ("%d",&iGuess);
if (iSecret<iGuess) puts ("The secret number is lower");
else if (iSecret>iGuess) puts ("The secret number is higher");
} while (iSecret!=iGuess);
puts ("Congratulations!");
return 0;
}