Advertisement
Spocoman

Cat Life

Sep 15th, 2023
719
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <iostream>
  2. #include <string>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     string catBreed, catGender;
  8.     getline(cin, catBreed);
  9.     cin >> catGender;
  10.  
  11.     int breedYears =
  12.         catBreed == "Siberian" ? 11 :
  13.         catBreed == "American Shorthair" ? 12 :
  14.         catBreed == "British Shorthair" ? 13 :
  15.         catBreed == "Persian" ? 14 :
  16.         catBreed == "Siamese" ? 15 :
  17.         catBreed == "Ragdoll" ? 16 : 0;
  18.  
  19.  
  20.     if (catGender == "f") {
  21.         breedYears++;
  22.     }
  23.  
  24.     breedYears > 0 ?
  25.         printf("%i cat months", breedYears * 2) :
  26.         printf("%s is invalid cat!", catBreed);
  27.  
  28.     return 0;
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement