Complete the cat class so the main function above produces the following output:
White cat is sitting
Black cat is sitting Brown cat is jumping
Red cat is purring
Blue cat is sitting Purple cat is jumping
class Cat
{
public:
Cat(string color)
{
this->color = color;
}
void Purring()
{
cout << color << "cat is purring" << endl;
}
void Jumping()
{
cout << color << "cat is jumping" << endl;
}
void Sitting()
{
cout << color << "cat is sitting" << endl;
}
private:
string color;
};
int main()
{
Cat wcat("White");
Cat bcat("Black");
Cat brcat("Brown");
Cat rcat("Red");
Cat blcat("Blue");
Cat pcat("Purple");
wcat.Sitting();
bcat.Sitting();
brcat.Jumping();
rcat.Purring();
blcat.Sitting();
pcat.Jumping();
}
Comments
Leave a comment