Advertisement
DraKiNs

[APP] Adivinhar Número

Jul 31st, 2011
364
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.17 KB | None | 0 0
  1.  
  2. /*==============================================================================
  3.              _ ____        _____          __  __
  4.             (_)  _ \ ___  |_   _|__  __ _|  \/  |
  5.             | | |_) / __|   | |/ _ \/ _` | |\/| |
  6.             | |  __/\__ \   | |  __/ (_| | |  | |
  7.             |_|_|   |___/   |_|\___|\__,_|_|  |_|
  8.  
  9. ==============================================================================*/
  10.  
  11. #include <stdio.h>
  12. #include <stdlib.h>
  13. #include <time.h>
  14. #include <conio.h>
  15.  
  16. int main()
  17. {
  18.     //Enfeites
  19.     system("title [iPs TeaM] - Campeonato Programadores - Projeto Bruno da Silva");
  20.     system("color 8f");
  21.  
  22.     printf("Digite seu numero de 0 a 10 para tentar adivinhar: \n\n");
  23.  
  24.     //Pegar número
  25.     int escolhido = 0;
  26.     scanf("%d", &escolhido);
  27.  
  28.     if(escolhido < 0 || escolhido > 10)
  29.     {
  30.         printf("Erro, deve escolher um numero entre 0 e 10 \n\n");      
  31.         return system("pause");
  32.     }
  33.  
  34.     // Checar
  35.     srand (time(NULL));
  36.     int random = (rand() % 10);
  37.     if(escolhido == random)
  38.     {
  39.         printf("Parabens você conseguiu acertar o numero! \n\n");
  40.  
  41.     }
  42.     else
  43.     {
  44.         printf("\n\n  Voce errou, o numero era: %d \n\n", random);
  45.     }
  46.     return system("pause");
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement