#include <iostream.h>
class area_cl {
public:
double height;
double width;
};
class box : public area_cl {
public:
double area();
box(double h,double w);
};
class isosceles : public area_cl {
public:
double area();
isosceles(double h,double w);
};
box::box(double h,double w)
{
height = h;
width = w;
}
isosceles::isosceles(double h,double w)
{
height = h;
width = w;
}
double box::area()
{
return height * width;
}
double isosceles::area()
{
return 0.5 * height * width;
main()
{
box b(10.0, 5.0);
isosceles i(4.0, 6.0);
cout << "Box: " << b.area() << "n";
cout << "Triangle: " << i.area() << "n";
return 0;
}
요기까지 구요...
에러 구문은...
C:C++ex4-1.cpp(44) : error C2065: 'main' : undeclared identifier
C:C++ex4-1.cpp(45) : error C2143: syntax error : missing ';' before '{'
C:C++ex4-1.cpp(54) : fatal error C1004: unexpected end of file found
Error executing cl.exe.
입니다;;
대체 어디가 에러가 난건가요 =_=;
그냥 지나가던 뉴비입니다
훼인 아니에요 '-'