Advertisement
Spocoman

09. Fruit or Vegetable

Sep 4th, 2023
893
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.50 KB | None | 0 0
  1. #include <iostream>
  2.  
  3. using namespace std;
  4.  
  5. int main() {
  6.     string product;
  7.     cin >> product;
  8.  
  9.     if (product == "banana" || product == "apple" || product == "kiwi" || product == "cherry" || product == "lemon" || product == "grapes") {
  10.         cout << "fruit" << endl;
  11.     }
  12.     else if (product == "tomato" || product == "cucumber" || product == "pepper" || product == "carrot") {
  13.         cout << "vegetable" << endl;
  14.     }
  15.     else {
  16.         cout << "unknown" << endl;
  17.     }
  18.  
  19.     return 0;
  20. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement