How to use Member function INPUT
I have a question on how can I use the member function INPUT to ask the user to input all the elements of the array and then to display all of the elements using DISPLAY?
#include <iostream>
class CAT
{
public:
CAT() { itsAge = 1; itsWeight=5; } // default constructor
~CAT() {} // destructor
int GetAge() const { return itsAge; }
int GetWeight() const { return itsWeight; }
void SetAge(int age) { itsAge = age; }
private:
int itsAge;
int itsWeight;
};
int main()
{
CAT Litter[5];
int i;
for (i = 0; i < 5; i++)
Litter[i].SetAge(2*i +1);
for (i = 0; i < 5; i++)
std::cout << "Cat #" << i+1<< ": "
<< Litter[i].GetAge() << std::endl;
return 0;
}