Advertisement
Guest User

Untitled

a guest
Nov 21st, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. #include <iostream>
  2. #include <cstring>
  3.  
  4. class Animal
  5. {
  6. public:
  7.  
  8. char Name;
  9. char Nickname;
  10. int Price;
  11.  
  12. /* void Effect()
  13. {
  14. }*/
  15.  
  16. void PrintAnimal()
  17. {
  18. std::cout << this->Name << std::endl;
  19. std::cout << this->Nickname << std::endl;
  20. std::cout << this->Price << std::endl;
  21.  
  22. PrintAnimal2();
  23. }
  24. private:
  25.  
  26. double Nyash;
  27. int Eat;
  28.  
  29. void PrintAnimal2()
  30. {
  31. std::cout << this->Nyash << std::endl;
  32. std::cout << this->Eat << std::endl;
  33. }
  34.  
  35. };
  36.  
  37. bool Check(Animal n, char str)
  38. {
  39.  
  40.  
  41.  
  42. int l = strlen(n.Nickname);
  43. bool flag = true;
  44.  
  45. for (int i = 0; i < l; i++) {
  46.  
  47. if (n.Nickname[i] != str[i]) {
  48.  
  49. flag = false;
  50. break;
  51. }
  52. }
  53. return flag;
  54.  
  55. }
  56.  
  57.  
  58. int main() {
  59.  
  60. char str;
  61. Animal a;
  62.  
  63. std::cin >> a.Name >> a.Nickname >> a.Price >> str;
  64. std::cin >> str;
  65.  
  66. if (Check(a, str)) std::cout << "True" << std::endl;
  67. else std::cout << "False" << std::endl;
  68. std::cout << strlen(str)<< std::endl;
  69.  
  70. return 0;
  71. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement