Turbo-C
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
터보-C 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
Lua 게시판
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
볼랜드포럼 광고 모집

C/C++ Q/A
[1641] Re:Re:초보라...... 도와주세요
브라이언 [goldenboy] 1279 읽음    2002-11-27 16:03
답변 감사합니다. 그러나 아래코드는 제가 작성한건데 분명히 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();
}


+ -

관련 글 리스트
1638 초보라...... 도와주세요 브라이언 1361 2002/11/27
1640     Re:초보라...... 도와주세요 조준회 1337 2002/11/27
1641         Re:Re:초보라...... 도와주세요 브라이언 1279 2002/11/27
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.