Advertisement
Jonas_3k

#Example

Apr 16th, 2013
135
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.56 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<string.h>
  3. int main()
  4. {
  5.   char option[5];
  6.   puts("\nEscolha um animal:\tMacaco\tCobra\tLeao.");
  7.   printf("Agora responda-me, o animal escolhido e mamifero? [Sim/Nao] ");
  8.   fgets(option,5,stdin);
  9.   if(strcmp(option,"sim")>0)
  10.   {
  11.     printf("O animal vive na savana? [Sim/Nao] ");
  12.     fgets(option,5,stdin);
  13.     if(!strcmp("sim",option)>0)
  14.     {
  15.       puts("Voce escolheu \"Leao\"");
  16.     }
  17.     else
  18.     {
  19.       puts("Voce escolheu \"Macaco\"");
  20.     }
  21.   }
  22.   else
  23.   {
  24.     puts("Voce pensou em \"Cobra\"");
  25.   }
  26.   return 0;
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement