Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <string>
- using namespace std;
- int main()
- {
- string animal;
- int x;
- cout<<"================================================================================";
- cout<<" ANIMAL IDENTIFICATION"<<endl;
- cout<<"================================================================================"<<endl;
- cout<< "Herbivores: eat only plants";
- cout<< "\nCarnivores: eat only meat or fish";
- cout<< "\nOmnivores: eat both plants and animals"<<endl;
- cout<<"\n*Available Choices: \n *Horse \t*Spider \t*Pig"<<endl;
- cout<<" *Carabao \t*Frog \t*Chicken"<<endl;
- cout<<" *Rabbit \t*Lion \t*Cat"<<endl;
- cout<<" *Cow \t*Tiger \t*Fish\n"<<endl;
- cout<< "\nEnter the name of the Animal: ";
- cin>>animal;
- if(animal == "horse" || animal == "Horse"){
- x =1;}
- else if(animal == "carabao" || animal == "Carabao"){
- x = 2;}
- else if(animal == "rabbit" || animal == "Rabbit"){
- x = 3;}
- else if(animal == "cow" || animal == "Cow"){
- x = 4;}
- else if(animal == "spider" || animal == "Spider"){
- x = 5;}
- else if(animal == "frog" || animal == "Frog"){
- x = 6;}
- else if(animal == "lion" || animal == "Lion"){
- x = 7;}
- else if(animal == "tiger" || animal == "Tiger"){
- x = 8;}
- else if(animal == "pig" || animal == "Pig"){
- x = 9;}
- else if(animal == "chicken" || animal == "Chicken"){
- x = 10;}
- else if(animal == "cat" || animal == "Cat"){
- x = 11;}
- else if(animal == "fish" || animal == "Fish"){
- x = 12;}
- else{
- x = 0;}
- switch(x)
- {
- case 1:
- case 2:
- case 3:
- case 4:
- cout<< "Does the Animal eat plants: YES"<<endl;
- cout<< "Does the Animal eat meat: NO"<<endl;
- cout<< "Answer: a "+animal+" is a Herbivore Animal."<<endl;
- break;
- case 5:
- case 6:
- case 7:
- case 8:
- cout<< "Does the Animal eat plants: NO"<<endl;
- cout<< "Does the Animal eat meat: YES"<<endl;
- cout<< "Answer: a "+animal+" is a Carnivore Animal."<<endl;
- break;
- case 9:
- case 10:
- case 11:
- case 12:
- cout<< "Does the Animal eat plants: YES"<<endl;
- cout<< "Does the Animal eat meat: YES"<<endl;
- cout<< "Answer: a "+animal+" is an Omnivore Animal."<<endl;
- break;
- default:
- cout<< "Not Found in Choices!"<<endl;
- }
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement