I am receiving three c2228 errors when I try to compile my program.
*edit* I am dealing with rectangular prisms in this program.*edit*
Here is my code:
#include "stdafx.h"
#include <iostream>
#include <iomanip>
using namespace std;
class Rect
{
private:
double length;
double width;
double hight;
public:
Rect(double l = 1.0, double w = 1.0, double h = 1.0)
{
length = l;
width = w;
hight = h;
}
void setnewvalues(double, double, double);
void volume(double, double, double);
void area(double, double, double);
void showvalues(double, double, double);
};
void Rect::setnewvalues(double l, double w, double h)
{
length = l;
width = w;
hight = h;
return;
}
void Rect::volume(double l, double w, double h)
{
double volume;
length = l;
width = w;
hight = h;
volume = length * width * hight;
cout << " " << volume << " ";
return;
}
void Rect::area(double l, double w, double h)
{
double area;
length = l;
width = w;
hight = h;
area = (4 * (length * width)) + (2 * (width * hight));
cout << area << endl;
return;
}
void Rect::showvalues(double l, double w, double h)
{
length = l;
width = w;
hight = h;
cout << setw(6) << length << " " << setw(5) << width << " "
<< setw(5) << hight;
return;
}
int _tmain(int argc, _TCHAR* argv[])
{
Rect recta(double l, double w, double h);
cout << "length width hight volume area\n"
<< "------ ----- ----- ------ ----" << endl;
recta.showvalues();
recta.volume();
recta.area();
return 0;
}
lab11makir.cpp(86) : error C2228: left of '.showvalues' must have class/struct/union
lab11makir.cpp(87) : error C2228: left of '.volume' must have class/struct/union
lab11makir.cpp(88) : error C2228: left of '.area' must have class/struct/union
Any suggestions or help would be appreciated. Thank you.