My c++ program error

Can someone please help me fix following c++ program?


#include "stdafx.h"
#include <iostream>
#include <string>
#include <iomanip>
#include <cmath>
#include <cstdlib>
using namespace std;

class Square
{
public:    

Square(float side_l, float side_w);
Square();
~Square();  
void setLength(float side_l);
void setWidth(float side_w);
float getLength();
float getWidth();
double findArea();
double findPerimeter() ;  

private:
float length;
float width;
};    
const int NUMBEROFOBJECTS = 4;  

void main()    

{
Square box[NUMBEROFOBJECTS];
 
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;  
}    

system("pause");
}    
void Square::setLength(float side_l)
{
length = side_l;
}  
void Square::setWidth(float side_w)
{
width = side_w;
}      
float Square::getLength()
{
return length;
}  
float Square:: getWidth()
{
return width;
}  
double Square::findArea()
{
return length * width;
}  
double Square::findPerimeter()
{    
return ((2 * length) + (2 * width));
}

Square::Square(float side_l, float side_w)
{
length = side_l; width = side_w;
}
Square::Square()
{
length = 1; width = 1;
}
Square::~Square()
{

}

If you slice that #include "stdafx.h" off the top and make main return an int rather than a void (in C++ main returns an int, always always always), it compiles.

What does it do that you think it shouldn't, or not do that you think it should?
OP, don't double post please.
Topic archived. No new replies allowed.