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
[47222] Re:이거 수정을 할수 있나요??
로리시아 [lolisia] 717 읽음    2006-11-29 14:11
아래 코드에서 #include <condefs.h> 가 없어도 잘 작동합니다.
단, getch()를 사용하시려면 #include <conio.h>를 사용하셔야겠죠.

프로그램을 단순하게 바꾸시는건 직접 하셔야 할 것 같습니다;

C++초보 님이 쓰신 글 :
: 여기 밑에 프로그램 짠거를요...
: #include <condefs.h>이거 안쓰고 하는 방법 없나요??ㅠ
: 프로그램이 너무 이해하기가 어려워요 ㅠㅠ
: 단순하게 바꿔주세요 ㅠㅠ
: 너무 길어서 이해하기도 힘들어요..
: 최대한 단순하게요
:
:
:
: #include <stdio.h>
: #include <stdlib.h>
: #include <condefs.h>
:
:
: int cards1[3][10];
: int count = 0;
: char card[3][10];
: int x, y,x1,y1;
:
: void cards(void);
: void cardprint(void);
: void cardacc(void);
: void cardinp(void);
:
: //---------------------------------------------------------------------------
: int main(int argc, char* argv[])
: {
: cards();
:
: for(int i = 0 ; i < 10 ; i++){ card[1][i] = '?'; }
: for(int j = 0 ; j < 10 ; j++){ card[2][j] = '?'; }
:
:
: do {
: x = 0; y = 0; x1 = 0; y1 = 0;
:
:
: for(int i = 0 ; i < 10 ; i++){
: if(cards1[1][i] == -48){ card[1][i] = 0; }
: }
: for(int i = 0 ; i < 10 ; i++){
: if(cards1[2][i] == -48){ card[2][i] = 0; }
: }
:
:
: cardprint();
: cardinp();
:
:
: if(x == x1 && y == y1){ printf("\n\nError!!"); break; }
:
: cardacc();
:
: } while(count != 10);
:
: printf("\n\n\n GameOver!~");
: getch();
: return 0;
: }
:
:
: //---------------------------------------------------------------------------
: void cards(void)
: {
: int datas[20], tmp;
: // 1234....891234....789 이런식의 데이터를 대입
: for(int i = 0 ; i < 20 ; i++){ datas[i] = i; }
: for(int i = 10 ; i < 20 ; i++){ datas[i] = datas[i] - 10; }
:
:
: for(int x = 0 ; x < 20 ; x++)
: {
: for(int y = 0 ; y < 20 ; y++)
: {
: if(datas[x] < rand() % 20)
: {
: tmp = datas[x];
: datas[x] = datas[y];
: datas[y] = tmp;
: }
: }
: }
:
: for(int i = 0 ; i < 10 ; i++){ cards1[1][i] = datas[i]; }
: for(int j = 0 ; j < 10 ; j++){ cards1[2][j] = datas[j+10]; }
: }
:
:
: //---------------------------------------------------------------------------
: void cardprint(void)
: {
: for(int i = 0 ; i < 10 ; i++){ printf(" %d",i); }
: printf("\n");
: printf("1 ");
: for(int i = 0 ; i < 10 ; i++){ printf(" %c ",card[1][i]); }
: printf("\n2 ");
: for(int j = 0 ; j < 10 ; j++){ printf(" %c ",card[2][j]); }
: }
:
:
: //---------------------------------------------------------------------------
: void cardacc(void)
: {
:
: if(cards1[y][x] == -48)
: {
: card[y1][x1] = '?';
: printf("\n\nError!!");
: getch();
:
: }
: else if(cards1[y1][x1] == -48)
: {
: card[y][x] = '?';
: printf("\n\nError!!");
: getch();
: }
:
: else if(card[y][x] == card[y1][x1])
: {
: card[y][x] = 0;
: card[y1][x1] = 0;
: cards1[y][x] = -48;
: cards1[y1][x1] = -48;
: count++;
:
: }
: else
: {
: card[y][x] = '?';
: card[y1][x1] = '?';
: getch();
: }
: }
: //---------------------------------------------------------------------------
: void cardinp(void)
: {
:
: printf("\n\n1 가로 : ");
: scanf("%d",&x);
: printf("\n1 세로 : ");
: scanf("%d",&y);
:
: card[y][x] = cards1[y][x] + 48;
:
: cardprint();
: printf("\n\n2 가로 : ");
: scanf("%d",&x1);
: printf("\n2 세로 : ");
: scanf("%d",&y1);
: card[y1][x1] = cards1[y1][x1] + 48;
: cardprint();
: }

+ -

관련 글 리스트
47220 이거 수정을 할수 있나요?? C++초보 779 2006/11/29
47222     Re:이거 수정을 할수 있나요?? 로리시아 717 2006/11/29
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.