|
안녕하세요..c++ 빌더로 공부를 하고 있습니다..
도데체 이 소스의 에러의 이유를 모르겠네요..참고로 teach your self c++10.2 소스입니다..이것 말고도 소스 에러가 부지기수로 나고 있어서 고치고 고쳐서 코딩해보는데 힘드네요..휴..
//---------------------------------------------------------------------------
#include <vcl.h>
#include <iostream.h>
#pragma hdrstop
//---------------------------------------------------------------------------
class Rectangle
{
public :
Rectangle(int width, int height);
~Rectangle();
void DrawShape(int aWidth, int aHeight, int UseCurrentVals = 1);
private :
int itsWidth;
int itsHeight;
};
Rectangle::Rectangle(int width, int height)
{
itsWidth = width;
itsHeight = height;
}
Rectangle::~Rectangle()
{
}
void Rectangle::DrawShape(int width, int height, int UseCurrentVals)
{
int printWidth;
int printHeight;
if (UseCurrentVals != 1)
{
printWidth = itsWidth;
printHeight = itsHeight;
}
else
{
printWidth = width;
printHeight = height;
}
for (int i = 0; i<printWidth; i++)
{
for(int j = 0; j<printHeight; j++)
{
cout << "*";
}
cout << "\n";
}
}
int main()
{
Rectangle rect;
cout << "DrawShape(0, 0, TRUE)..\n";
rect.DrawShape(0, 0, TRUE);
cout << "DrawShape(40, 2)..\n";
rect.DrawShape(40, 2);
int i;
cin >> i;
return 0;
}
//---------------------------------------------------------------------------
에러는 메인함수의 Rectangle rect; -> E2379 Statement missing ;
rect.DrawShape(0, 0, TRUE); -> E2451 Undefined symbol 'rect'
에서 나옵니다..도데체 이유가 뭘까요? 흐흐흑..
|