Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- struct Cat {
- int eyeColor [3];
- string name;
- void Name (){
- cout << "My name is " << name << endl;
- }
- void setName(string new_name){
- name=new_name;
- }
- void setEyeColor ( int r ,int g,int b){
- eyeColor[0]=r;
- eyeColor[1]=g;
- eyeColor[2]=b;
- }
- string getName(){
- return name;
- }
- int getEyeColor(int index){
- return eyeColor [index];
- }
- };
- int main()
- {
- Cat c1;
- c1.setName("Boricka");
- c1.setEyeColor(0,0,255);
- cout << c1.getName() << endl;
- int r =c1.getEyeColor(0);
- cout << "RED-" << r << endl;
- int g =c1.getEyeColor(0);
- cout << "Grin-" << g << endl;
- int b =c1.getEyeColor(255);
- cout << "Blue-" << b << endl;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement