|
답변 감사합니다. 그러나 아래코드는 제가 작성한건데 분명히 main()가 존재하거든요(passcar.cpp)
그리고 소스파일과 관계있는 헤더파일 또한 모두 작성해 주었는데도 .....
자꾸 에러가 발생합니다. 다른 의심가는 사항이 있으시면
좋은 의견 부탁드립니다.(참고로 visual c++6.0에서는 정상적으로 동작합니다.)
감사합니다.
#include "car.h"
car :: car(int destination)
{
rand();
dest = destination;
forward = 1;
position = 0;
}
int car :: steercar(void)
{
cout<<"driving...\n";
getch();
if( ++position == dest)
return 1;
else
return 0;
}
void car :: reversecar(void)
{
if(forward)
{
cout<<"braking up\n";
getch();
--position ;
forward = 0;
}
else
{
forward = 1;
}
}
#include"PASSCAR.H"
int passcar :: pass(void)
{
cout<<"passing ........\n";
getch();
position = position+2;
if(position >=dest)
return 1;
else
return 0;
}
int findobstacle(void)
{
int r = rand();
if(r)
return 0;
else
return 1;
}
void main(void)
{
rand();
car2.startcar();
while( !at_destination )
{
at_destination = car2.steercar();
obstacle = findobstacle();
if ( obstacle && !at_destination)
{
cout<<" look out! there's something in the road !n";
getch();
car2.brakecar();
car2.reversecar();
at_destination = car2.pass();
}
}
cout<<"Ah, home at last \n ";
car2.turnoffcar();
}
|