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

C++빌더 Q&A
C++Builder Programming Q&A
[4636] 에러 좀 잡아주세요!!
김창수 [] 2776 읽음    2000-12-18 00:00
자동차 게임인데요..
c++로 컴파일하면 에러가 없는데요..
make하면 에러가 생겨요..
도저히 모르겠어요..
제발 좀 도와 주세요..


#include "conio.h"
#include "stdlib.h"
#include "time.h"
#include "dos.h"
#include "stdio.h"
#include "iostream.h"

#define LEFT 27   //창의 좌표들
#define TOP 3
#define RIGHT 53
#define BOT 23

void display();   //장애물(*)을 무작위로 생성
void scroll();    //한 줄씩 아래로 내림
void init();      //윈도우의 크기 및 색깔 지정
void restore();   //화면을 원래 상태로 복구
int score(int a);     //점수 계산 함수
int linepr(int b);    //각 단계가 끝나는 시점 표시
int success(int c);    //마지막 단계 끝냈을 때 실행
void gotoxy(int x,int y); 
void insline(void);
int wherex(void);
void delay(int f);
void window(int g,int h,int j,int k);
int rand(int l);
void main()
{
        int  i, nx=14, ny=15, pos[20];
        int grade=1, jumsu=0, g_flag=0;
        char key;
        init();
      
        for(i=1;i<22;i++)  //길 옆의 라인 출력
        {
                gotoxy(1,i);
        cout<<"벽";
        gotoxy(27,i);
        cout<<"벽";
        }
        i=1;
        linepr(grade);
        insline();
        while(1)
        {
                if (kbhit())
                    key=getch();          //키를 입력받아,
                if (key=='\r') //\r은 커서의 방향을 줄의 처음으로 이동
                    break;              //차를 좌우로 이동
                else if (key=='4' && nx!=1)
                    nx--;
                else if (key=='6' && nx!=27)
                    nx++;

               
                gotoxy(1,1);
                cout<<"벽";
                gotoxy(27,1);
                cout<<"벽";
              
                gotoxy(nx,ny);            //자동차 출력
                cout<<"A";
                if ( g_flag == 200 )      //200회가 지나면,
                {                         //단계를 올리고,
                        if ( grade == 3 ) //마지막 단계까지 완료.
                        { success(jumsu); break; }
                        g_flag=0;         //라인 출력
                        grade++;
                        linepr(grade);
                }

                g_flag++;
                display();                //장애물 출력

                if (pos[++i]==nx+1 || nx==1 || nx==27)
                {                         //장애물(벽)의 x좌표를 자동차의 좌표와 비교,
                   
                        gotoxy(nx,ny);
                        cout<<" ";
                        ny++;            //자동차를 한 줄 뒤로 이동
                        jumsu-=20;
                }
            

                if ( i == ny ) i=1;
                pos[i] =  nx;        //장애물의 x좌표를 배열에 저장

                if ( grade == 1 ) { delay(200); jumsu+=10; }    //각 단계마다 속도 설정
                else if ( grade == 2 ) { delay(100); jumsu+=20; }
                else if ( grade == 3 ) { delay(50); jumsu+=30; }

                gotoxy(nx,ny);
                cout<<" ";

                if ( ny == 22 )
                { score(jumsu); break; }   //자동차가 끝까지 밀렸을 때 점수 출력
                scroll();
                key=' ';
        }
     
        restore();
}
void init()               //초기 창 크기 및 색깔 지정
{
     
     
     
        window(LEFT, TOP, RIGHT, BOT);
         
}
void display()            //장애물 색깔 지정
{
        int ix;    
        ix = rand(26)+1; //raddom(num)는 num만큼 난수를 발생생+1은 초값을 1로 설정
        if ( ix >= 26 )
        ix=25;
        gotoxy(ix+1,1);
        cout<<"*";
}
void scroll()             //한 줄씩 아래로 내림
{
        gotoxy(1,1);
        insline();    //라인 삽입
}
void restore()            // 화면을 원래 상태로 복구
{
        window(1,1,80,25);//left,top,right,bottom
      
}
int score(int jumsu)     //마지막 점수 출력
{
       
        gotoxy(5,13);
        cout<<"꽝 !!!\n";
        gotoxy(5,15);
        cout<<"점수 :"<<jumsu<<"점\n";
        if ( jumsu < 3000 )
        {
                gotoxy(3,17);
                cout<<"애개~~~ 겨우 이정도 ?";
        }
        else if ( jumsu < 10000 )
        {
                gotoxy(3,17);
                cout<<"참 안타깝군요 !";
        }
        gotoxy(5,19);
        cout<<"게임 끝 !!!";
      
        delay(4000);
        getch();
        return jumsu;
}
int success(int jumsu)
{
        gotoxy(5,13);
        cout<<"완료 !!!\n";
        gotoxy(5,15);
        cout<<"점수 :"<<jumsu<<"점\n";
        gotoxy(5,17);
        cout<<"참 잘했어요 !!!";
        gotoxy(5,19);
        cout<<"게임 끝 !!!";
     
        delay(4000);
        getch();
        return 1;
}
int linepr(int grade)    //각 단계 시작 시점 출력
{
        gotoxy(2,1);
        cout<<"--------"<<grade<<" 단계 ---------";
        return 1;
}

+ -

관련 글 리스트
4636 에러 좀 잡아주세요!! 김창수 2776 2000/12/18
4639     Re:에러 좀 잡아주세요!! 방랑객 2737 2000/12/19
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.