게시판 즐겨찾기
편집
드래그 앤 드롭으로
즐겨찾기 아이콘 위치 수정이 가능합니다.
c로 가위바위보 만드는데 scanf질문이요 ㅜㅜ..
게시물ID : jisik_114012짧은주소 복사하기
작성자 : ★☆
추천 : 0
조회수 : 605회
댓글수 : 2개
등록시간 : 2011/12/07 00:34:15
첫번째 사진을 보시면 입력받는부분이잇는데
두번째사진보면 엔터를 여러번입력받으면 커서가 내려가는게 거슬리네요 ㅜㅜ..
엔터를 눌러도 첫번째 사진위치에 커서를 고정시키는 방법이 혹시있나요..?ㅜㅜ



int easyplay()
{
 int player,computer,a=0;                
 char *P, *C; 
 int comhp,userhp,ma;
  comhp=500,userhp=600,ma=100;
 system("cls");
 while(1)
 {
  computer=rand()%3+1;
    gotoxy(3,3);
    printf("□□□□□□□□□□□□□□□□□□□□□  □□□□□□□□□□\n");
gotoxy(3,4);
printf("□■■■■■■■■■■■■■■■■■■■□  □                □\n");
gotoxy(3,5);
printf("□■                                  ■□  □                □\n");
gotoxy(3,6);
printf("□■                                  ■□  □                □\n");
gotoxy(3,7);
printf("□■                                  ■□  □                □\n");
gotoxy(3,8);
printf("□■          ▶ 바위는 : 1           ■□  □                □\n ");
gotoxy(3,9);
printf("□■          ▶ 가위는 : 2           ■□  □                □\n ");
gotoxy(3,10);
printf("□■           ▶ 보는 : 3            ■□  □                □\n ");
gotoxy(3,11);
printf("□■                                  ■□  □                □\n");
gotoxy(3,13);
printf("□■                                  ■□  □                □\n");
gotoxy(3,14);
printf("□■                                  ■□  □                □\n");
gotoxy(3,15);
printf("□■■■■■■■■■■■■■■■■■■■□  □□□□□□□□□□\n");
gotoxy(3,17);
printf("□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□\n");
gotoxy(3,18);
printf("□            당신의 hp : %d 컴퓨터의 hp :   %d             □\n",userhp,comhp);
gotoxy(3,19);
printf("□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□\n");
gotoxy(29,12);
printf("            ■□  □                □\n");
gotoxy(3,12);
printf("□■               입력 "); 
scanf("%d",&player);
  

  if(player != 1 && player != 2 && player != 3)
  {
   printf("※1~3중에 선택해주세요.\n\n");
   press();
   system("cls");
  }
  else 
  {
   

   if(computer==1) 
   {
    C="바위";
   }
   else if(computer==2) 
   {
    C="가위";
   }
   else 
   {
    C="보";
   }
   
   if(player==1) 
   {
    P="바위";
   }
   else if(player==2) 
   {
    P="가위";
   }
   else 
   {
    P="보";
   }
   

   if(player == 1 || player == 2 || player == 3)
   {
   gotoxy(47,3);
   printf("□□□□□□□□□□\n");
   gotoxy(47,4);
   printf("□                □\n");
   gotoxy(47,5);
   printf("□  *당신 : %s \n",P);
   gotoxy(47,6);
   printf("□  *컴퓨터: %s\n",C);
   gotoxy(47,7);
   printf("□                □\n");
   gotoxy(47,8);
   printf("□□□□□□□□□□\n");
   }
   


   if((player==1 && computer==2) || (player==2 && computer==3) 
    || (player==3 && computer==1))
   {
    ;

gotoxy(53,11);
    printf("*승!* \n");
gotoxy(51,12);
printf("컴퓨터hp-100 \n");
comhp=comhp-ma;
press();
   system("cls");

   }


   else if((player == 1 && computer == 1) || (player == 2 && computer == 2)
    || (player == 3 && computer == 3))
   {
    gotoxy(53,12);
    printf("*비김!* \n");
press();
   system("cls");

   }


   else
   {
    gotoxy(53,11);
    printf("*패..* \n");
gotoxy(51,12);
printf("당신의hp-100 \n");
userhp=userhp-ma;
press();
   system("cls");

   }
      if(comhp==0)
   {
   system("cls");
   gotoxy(3,3);
printf("□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□\n");
gotoxy(3,4);
printf("□■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■□\n");
gotoxy(3,5);
printf("□■                                                        ■□\n");
gotoxy(3,6);
printf("□■                                                        ■□\n");
gotoxy(3,7);
printf("□■                                                        ■□\n");
gotoxy(3,8);
printf("□■                                                        ■□\n");
gotoxy(3,9);
printf("□■                                                        ■□\n");
gotoxy(3,10);
printf("□■                                                        ■□\n");
gotoxy(3,11);
printf("□■                                                        ■□\n");
gotoxy(3,12);
printf("□■                                                        ■□\n");
gotoxy(3,13);
printf("□■                                                        ■□\n");
gotoxy(3,14);
printf("□■                  Win                                   ■□\n");
gotoxy(3,15);
printf("□■      아무버튼이나 누르면 난이도선택으로이동됩니다.     ■□\n");
gotoxy(3,16);
printf("□■                                                        ■□\n");
gotoxy(3,17);
printf("□■                                                        ■□\n");
gotoxy(3,18);
printf("□■                                                        ■□\n");
gotoxy(3,19);
printf("□■                                                        ■□\n");
gotoxy(3,20);
printf("□■                                                        ■□\n");
gotoxy(3,21);
printf("□■                                                        ■□\n");
gotoxy(3,22);
printf("□■                                                        ■□\n");
gotoxy(3,23);
printf("□■                                                        ■□\n");
gotoxy(3,24);
printf("□■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■□\n");
gotoxy(3,25);
printf("□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□\n");
comhp=500,userhp=600,ma=100;
press();
system("cls");
next();
   }
   else if(userhp==0)
   {
 system("cls");
 gotoxy(3,3);
printf("□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□\n");
gotoxy(3,4);
printf("□■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■□\n");
gotoxy(3,5);
printf("□■                                                        ■□\n");
gotoxy(3,6);
printf("□■                                                        ■□\n");
gotoxy(3,7);
printf("□■                                                        ■□\n");
gotoxy(3,8);
printf("□■                                                        ■□\n");
gotoxy(3,9);
printf("□■                                                        ■□\n");
gotoxy(3,10);
printf("□■                                                        ■□\n");
gotoxy(3,11);
printf("□■                                                        ■□\n");
gotoxy(3,12);
printf("□■                                                        ■□\n");
gotoxy(3,13);
printf("□■                                                        ■□\n");
gotoxy(3,14);
printf("□■                 Game over                              ■□\n");
gotoxy(3,15);
printf("□■      아무버튼이나 누르면 난이도선택으로이동됩니다.     ■□\n");
gotoxy(3,16);
printf("□■                                                        ■□\n");
gotoxy(3,17);
printf("□■                                                        ■□\n");
gotoxy(3,18);
printf("□■                                                        ■□\n");
gotoxy(3,19);
printf("□■                                                        ■□\n");
gotoxy(3,20);
printf("□■                                                        ■□\n");
gotoxy(3,21);
printf("□■                                                        ■□\n");
gotoxy(3,22);
printf("□■                                                        ■□\n");
gotoxy(3,23);
printf("□■                                                        ■□\n");
gotoxy(3,24);
printf("□■■■■■■■■■■■■■■■■■■■■■■■■■■■■■■□\n");
gotoxy(3,25);
printf("□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□□\n");
 comhp=500,userhp=600,ma=100;
press();
system("cls");
next();
   
   }
   
  }

 }

 }

소스는 대충이래요..
전체 추천리스트 보기
새로운 댓글이 없습니다.
새로운 댓글 확인하기
글쓰기
◀뒤로가기
PC버전
맨위로▲
공지 운영 자료창고 청소년보호