Advertisement
desislava_topuzakova

03. Animal Type

Jan 23rd, 2022
768
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.48 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. int main()
  5. {
  6.     string animal;
  7.     cin >> animal;
  8.  
  9.     //dog -> mammal
  10.     //crocodile, tortoise, snake -> reptile
  11.     //others -> unknown
  12.  
  13.     if (animal == "dog")
  14.     {
  15.         cout << "mammal" << endl;
  16.     }
  17.     else if (animal == "crocodile" || animal == "tortoise" || animal == "snake")
  18.     {
  19.         cout << "reptile" << endl;
  20.     }
  21.     else
  22.     {
  23.         cout << "unknown" << endl;
  24.     }
  25.  
  26.  
  27.     return 0;
  28. }
  29.  
  30.  
  31.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement