Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- int main()
- {
- int n,i,r;
- char rep;
- srand(time(NULL));
- do{
- n=rand() %101;
- }while (n==0);
- do{
- i=10;
- printf ("%d",n);
- printf ("L'entier est entre 1 et 100 et il vous reste %d tentatives: ",i);
- do{
- scanf ("%d",&r);
- i=i-1;
- if (r>n)
- {
- printf ("\nL'entier est en desous de %d, il vous reste %d tentatives: ",r,i);
- }else if (r<n)
- {
- printf ("\nL'entier est au dessus de %d, il vous reste %d tentatives: ",r,i);
- }
- }while(r!=n && i!=0);
- system ("cls");
- if (i <=4 && i>=1)
- {
- printf ("\nPas mal!");
- }else if ((i<=8) && (i>=5))
- {
- printf ("\nBien joué!");
- }else if (i==9)
- {
- printf ("\nDu Premier coup! Toutes nos felicitations");
- }else if (r!=n)
- {
- printf ("\nLa prochaine fois!");
- }else if (i==0 && r==n)
- {
- printf ("\nC'était tout juste");
- }
- do{
- printf ("\nVoulez vous rejouer une partie?");
- scanf (" %c",&rep);
- }while (toupper(rep)!='N' && toupper(rep)!='O' );
- }while (toupper(rep)!='N');
- }
Add Comment
Please, Sign In to add comment