Advertisement
Guest User

Untitled

a guest
Jun 27th, 2017
49
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 3.04 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3. using namespace std;
  4.  
  5. int main()
  6. {  
  7.     string animal;
  8.     int x;
  9.    
  10.      cout<<"================================================================================";
  11.      cout<<"                           ANIMAL IDENTIFICATION"<<endl;
  12.      cout<<"================================================================================"<<endl;
  13.      
  14.      cout<< "Herbivores: eat only plants";
  15.      cout<< "\nCarnivores: eat only meat or fish";
  16.      cout<< "\nOmnivores: eat both plants and animals"<<endl;
  17.      
  18.      cout<<"\n*Available Choices: \n  *Horse \t*Spider \t*Pig"<<endl;
  19.      cout<<"  *Carabao \t*Frog   \t*Chicken"<<endl;
  20.      cout<<"  *Rabbit \t*Lion   \t*Cat"<<endl;
  21.      cout<<"  *Cow   \t*Tiger  \t*Fish\n"<<endl;
  22.      
  23.      cout<< "\nEnter the name of the Animal: ";
  24.      cin>>animal;
  25.      
  26.      if(animal == "horse" || animal == "Horse"){
  27.                 x =1;}
  28.      else if(animal == "carabao" || animal == "Carabao"){
  29.           x = 2;}
  30.      else if(animal == "rabbit" || animal == "Rabbit"){
  31.           x = 3;}
  32.      else if(animal == "cow" || animal == "Cow"){
  33.           x = 4;}
  34.      else if(animal == "spider" || animal == "Spider"){
  35.           x = 5;}
  36.      else if(animal == "frog" || animal == "Frog"){
  37.           x = 6;}
  38.      else if(animal == "lion" || animal == "Lion"){
  39.            x = 7;}
  40.      else if(animal == "tiger" || animal == "Tiger"){
  41.           x = 8;}
  42.      else if(animal == "pig" || animal == "Pig"){
  43.           x = 9;}
  44.      else if(animal == "chicken" || animal == "Chicken"){
  45.           x = 10;}
  46.      else if(animal == "cat" || animal == "Cat"){
  47.           x = 11;}
  48.      else if(animal == "fish" || animal == "Fish"){
  49.           x = 12;}
  50.      else{
  51.          x = 0;}
  52.      
  53.       switch(x)
  54.      {
  55.                   case 1:
  56.                   case 2:
  57.                   case 3:                      
  58.                   case 4:
  59.                        cout<< "Does the Animal eat plants: YES"<<endl;
  60.                        cout<< "Does the Animal eat meat: NO"<<endl;
  61.                        cout<< "Answer: a "+animal+" is a Herbivore Animal."<<endl;
  62.                         break;
  63.                   case 5:
  64.                   case 6:
  65.                   case 7:
  66.                   case 8:
  67.                         cout<< "Does the Animal eat plants: NO"<<endl;
  68.                         cout<< "Does the Animal eat meat: YES"<<endl;
  69.                         cout<< "Answer: a "+animal+" is a Carnivore Animal."<<endl;
  70.                         break;                    
  71.                   case 9:
  72.                   case 10:
  73.                   case 11:
  74.                   case 12:
  75.                         cout<< "Does the Animal eat plants: YES"<<endl;
  76.                         cout<< "Does the Animal eat meat: YES"<<endl;
  77.                         cout<< "Answer: a "+animal+" is an Omnivore Animal."<<endl;
  78.                         break;
  79.                   default:
  80.                           cout<< "Not Found in Choices!"<<endl;
  81.       }
  82.        
  83.       system("pause");
  84.       return 0;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement