Advertisement
Guest User

Untitled

a guest
Feb 26th, 2020
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. #include <iostream>
  2. using namespace std;
  3. struct Cat {
  4. int eyeColor [3];
  5. string name;
  6. void Name (){
  7. cout << "My name is " << name << endl;
  8. }
  9.  
  10. void setName(string new_name){
  11. name=new_name;
  12. }
  13. void setEyeColor ( int r ,int g,int b){
  14. eyeColor[0]=r;
  15. eyeColor[1]=g;
  16. eyeColor[2]=b;
  17. }
  18. string getName(){
  19. return name;
  20. }
  21. int getEyeColor(int index){
  22. return eyeColor [index];
  23. }
  24. };
  25. int main()
  26. {
  27. Cat c1;
  28. c1.setName("Boricka");
  29. c1.setEyeColor(0,0,255);
  30. cout << c1.getName() << endl;
  31. int r =c1.getEyeColor(0);
  32. cout << "RED-" << r << endl;
  33. int g =c1.getEyeColor(0);
  34. cout << "Grin-" << g << endl;
  35. int b =c1.getEyeColor(255);
  36. cout << "Blue-" << b << endl;
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement