Guest User

Untitled

a guest
Oct 20th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.92 KB | None | 0 0
  1. GNU nano 2.2.6 Arquivo: skittles.c
  2.  
  3. #include <cc50.h>
  4. #include <stdio.h>
  5. #include <stdlib.h>
  6. #include <time.h>
  7.  
  8. int
  9. main(void)
  10. {
  11. srand(time(NULL));
  12. int skittles = rand() % 1024;
  13. printf("%d\n", skittles);
  14. printf("Oi, sou a maquina falante de skittles, acerte quantas balas eu tenho que te dou todas! Fica a dica: o numero e entre 0 e 1203.\n");
  15. bool exit = false;
  16.  
  17. while(!exit);
  18. {
  19. int tentativa = GetInt();
  20. if(tentativa > 1024)
  21. {
  22. printf("Valor invalido\n");
  23. }
  24. else if(tentativa < 0)
  25. {
  26. printf("Valor invalido\n");
  27. }
  28. if(tentativa = skittles)
  29. {
  30. exit = true;
  31. }
  32. else
  33. {
  34. printf("Errado, tente novamente\n");
  35. }
  36.  
  37. if(exit = true)
  38. {
  39. printf("Parabens, voce acertou e ganhou todas as balas!\n");
  40. }
  41. }
Add Comment
Please, Sign In to add comment