for (int pos = 0; pos < NUMBEROFOBJECTS; pos++)
{
cout << "Information for box number " << pos + 1 << endl << endl;
cout << "The length of the box is " << box[pos].getLength() << endl;
cout << "The width of the box is " << box[pos].getWidth() << endl;
cout << "The area of the box is " << box[pos].findArea() << endl;
cout << "The perimeter of the box is " << box[pos].findPerimeter() << endl << endl;
}
First, all your class functions/definitions should be before your main() function (right under your class declaration)
Second, you shouldn't include stdafx.h, it is unnecessary
Third, Square box[NUMBEROFOBJECTS]; is invalid (you could achieve the same thing by using vectors and the STL, plus using the STL will give you more results [http://www.cplusplus.com/doc/tutorial/polymorphism/ ]), other wise you need to use multiple class definitions ex. Square box1;Square box2
Fourth, you don't need to use double unless used for high precision calculations
Fifth, your main() function should be a type int and should return 0
Sixth, it is a good idea to use the code tags so it can be more easily read
Fifth, your main() function should be a type int and should return 0
Presumably you mean the return type should be int. The type of main is different than its return type. In C++, return 0; is implied if nothing is returned from main.
popa6200 wrote:
Sixth, it is a good idea to use the code tags so it can be more easily read