Can someone help with this question? I'm getting confused to check the null value
A cowshed with 50 boxes as a class variable, each box can be occupied by one cow. Use an array of 50 pointers on cow; if a box is not occupied, the pointer is set to the value NULL
I have one more question. I separated my Programm in cpp, hpp, and main. I have created a milking() function. Now i want to implement it in my main function. I also want to create 3 Cow Objects and for each of them to show how much milk we have. This is what i got so far.
int main(int argc, char* argv[]) {
// Create 3 Cow Objects
boxes[0] = new Cow();
boxes[1] = new Cow();
boxes[2] = new Cow();
// Milking the cows; they give 5, 6 and 7 liters of milk
int i = 5;
int x = 6;
int z = 7;
cout << milking(i) << endl;
return i;
}