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
[22054] 간단한 프로그램 수정좀 도와주세요.
박성현 [] 623 읽음    2002-10-15 23:03
#include<stdio.h>
#include<conio.h>

void video(char [],char[],char[],int);
int run(char [],char [],char []);

  main()
{
char one[50],two[50],three[50];
int i;

for(i=0;i<50;i++) {   /*one,two,three배열을 공배로 채움*/
    one[i]=' ';
    two[i]=' ';
    three[i]=' ';
   }
one[0]='0';   /*one,two,three배열의 처음에는 1,2,3을 끝에는 E표식*/
two[0]='a';
three[0]='m';
one[49]='E';
two[49]='E';
three[49]='E';

video(one,two,three,50);

run(one,two,three);
}



  void video(char one[],char two[],char three[],int b)
{
                                            /*one,two,three배열을 보여줌*/
  int i;
  clrscr();
  for(i=0;i<b;i++) printf("%c",one[i]);
  printf("\n");
  for(i=0;i<b;i++) printf("%c",two[i]);
  printf("\n");
  for(i=0;i<b;i++) printf("%c",three[i]);
  printf("\n");
}



  int run(char one[],char two[],char three[])
{                     /*키입력받아 1,2,3을 달리게 한다.*/
int save1,save2,save3;   
char clk,temp;
save1=0;
save2=0;
save3=0;
for(; ; ) {
   
    printf("\n눌러라");
    clk=getch();
    if(clk=='e'||save1==48||save2==48||save3==48) {
        clrscr();
        printf("game over\n");
    if(save1==48) printf("0이 이겼다.");
    if(save2==48) printf("A가 이겼다.");
        if(save3==48) printf("M이 이겼다.");
       
        return -1;
       }
    if(clk=='0') {
        temp=one[save1];
        one[save1]=one[save1+1];
        one[save1+1]=temp;
        save1++;
       }
    if(clk=='a') {
        temp=two[save2];
        two[save2]=two[save2+1];
        two[save2+1]=temp;
        save2++;
       }
    if(clk=='m') {
        temp=three[save3];
        three[save3]=three[save3+1];
        three[save3+1]=temp;
        save3++;
       }

    video(one,two,three,50);
   }
}


달리기게임 소스인데요.
몇가지 수정하고 싶은데 에러가 나고 잘안되네여
우선 도착지의 "E"를 다른 단어로 바꾸고 싶구여
그리고 키보드를 누르고 있으면 그냥 다다다 가버리는데
이걸 눌렀다 떼야 가는걸로 수정하고 싶어요
좀 도와주세요.

+ -

관련 글 리스트
22054 간단한 프로그램 수정좀 도와주세요. 박성현 623 2002/10/15
30934     Re:간단한 프로그램 수정좀 도와주세요. 이영우 661 2002/10/16
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.