디시인사이드 갤러리

갤러리 이슈박스, 최근방문 갤러리

갤러리 본문 영역

[질문,C언어]질문있어여ㅕㅕㅕㅕㅕㅕ

Header갤로그로 이동합니다. 2009.06.18 07:20:42
조회 61 추천 0 댓글 4

#include <stdio.h>
#include <stdlib.h>
#include <windows.h>

#define Frame_Pins 10

void Boiling_Score_Main();
void Boiling_Score_Output();
void Boiling_Score_Input();
void Boiling_Score_Calculation(int First_Pin,int Second_Pin,int Third_Pin,int NextOnOff,int Before_Strike,int Next_Frame_First,int Next_Frame_Second);

struct Boiling_Games_Times
{
 struct Boiling_Frames_Times
 {
  char Throwing_Ball[1];
 }BFT[Frame_Pins];
 int Final_Third;
}BGT[Frame_Pins];

int Game = 1;
int Frame = 0;
int Frame_Total[10] = {0};
int Spear;
int Strike;

void main()
{
 int i,j;

 system("mode con: lines=80");
 Boiling_Score_Main();

 for(i=0;i<Frame_Pins;i++)
 {
  for(j=0;j<Frame_Pins;j++)
  {
   BGT[i].BFT[j].Throwing_Ball[0] = \'0\';
   BGT[i].BFT[j].Throwing_Ball[1] = \'0\';
  }
 }
}

void Boiling_Score_Main()
{
 printf("\\n           볼           링           점           수           판\\n");
 printf("\\n                                          현재까지 Average : %.2f\\n",(float)Frame_Total[Frame]/Game);
 Spear = 0;
 Strike = 0;
 Boiling_Score_Output();
}

void Boiling_Score_Output()
{
 SYSTEMTIME Nowtime;
 GetLocalTime(&Nowtime);

 int i = 0;

 do{
   printf("\\n%8d / %2d / %2d %6d 게임\\n",Nowtime.wYear,Nowtime.wMonth,Nowtime.wDay,Game);
   printf("┌──┬───┬───┬───┬───┬───┬───┬───┬───┬───┐");
   printf("│ 1  │  2   │  3   │  4   │  5   │  6   │  7   │  8   │  9   │  10  │");
   printf("├──┼───┼───┼───┼───┼───┼───┼───┼───┼───┤");
   printf("│%2d%2d│%3d%3d│%3d%3d│%3d%3d│%3d%3d│%3d%3d│%3d%3d│%3d%3d│%3d%3d│%2d%2d%2d│",
     BGT[i].BFT[0].Throwing_Ball[0],BGT[i].BFT[0].Throwing_Ball[1],
     BGT[i].BFT[1].Throwing_Ball[0],BGT[i].BFT[1].Throwing_Ball[1],
     BGT[i].BFT[2].Throwing_Ball[0],BGT[i].BFT[2].Throwing_Ball[1],
     BGT[i].BFT[3].Throwing_Ball[0],BGT[i].BFT[3].Throwing_Ball[1],
     BGT[i].BFT[4].Throwing_Ball[0],BGT[i].BFT[4].Throwing_Ball[1],
     BGT[i].BFT[5].Throwing_Ball[0],BGT[i].BFT[5].Throwing_Ball[1],
     BGT[i].BFT[6].Throwing_Ball[0],BGT[i].BFT[6].Throwing_Ball[1],
     BGT[i].BFT[7].Throwing_Ball[0],BGT[i].BFT[7].Throwing_Ball[1],
     BGT[i].BFT[8].Throwing_Ball[0],BGT[i].BFT[8].Throwing_Ball[1],
     BGT[i].BFT[9].Throwing_Ball[0],BGT[i].BFT[9].Throwing_Ball[1],BGT[i].Final_Third);
   printf("│%4d│%6d│%6d│%6d│%6d│%6d│%6d│%6d│%6d│%6d│",
     Frame_Total[0],Frame_Total[1],Frame_Total[2],Frame_Total[3],Frame_Total[4],
     Frame_Total[5],Frame_Total[6],Frame_Total[7],Frame_Total[8],Frame_Total[9]);
   printf("└──┴───┴───┴───┴───┴───┴───┴───┴───┴───┘");
   Game--; i++;
 }while(Game);

 Game++;
 Boiling_Score_Input();
}

void Boiling_Score_Input()
{
 int Result_Frame_First = 0;
 int Result_Frame_Second = 0;
 int Result_Frame_Third = 0;
 int NextOnOff = 0;
 int Before_Strike = 0;
 int Next_Frame_First = 0;
 int Next_Frame_Second = 0;
 int StrikeOn;

 while( 1 )
 {  
  if( Frame > 9 )
  {
   Frame = 0;
   Game++;
   system("cls");
   Boiling_Score_Main();
  }

  while( 1 )
  {
   printf("→%d번째 Game의 %d Frame 첫번째에 쓰러트린 핀의 갯수는? ",Game ,Frame+1);

   if(NextOnOff == 0)
   {
    scanf("%d",&Result_Frame_First);
   }
   else if(NextOnOff == 1)
   {
    scanf("%d",&Next_Frame_First);
   }

   if(Result_Frame_First != 10 )
   {
    printf("→%d번째 Game의 %d Frame 두번째에 쓰러트린 핀의 갯수는? ",Game ,Frame+1);
    if(NextOnOff == 0)
    {
     scanf("%d",&Result_Frame_Second);
    }
    else if(NextOnOff == 1 && StrikeOn == 1)
    {
     scanf("%d",&Next_Frame_Second);
    }

    if(Result_Frame_First + Result_Frame_Second == 10)
    {
     if(Result_Frame_First == 10)
     {StrikeOn = 1;}
     NextOnOff = 1;
     Frame++;
    }
    else
    {
     NextOnOff = 0;
     Frame++;
    }
   }
   else
   {
    Before_Strike = 1;
    Result_Frame_Second = 0;
    Result_Frame_Third = 0;
   }
  }

  if( Frame == 9 && Result_Frame_First != NULL )
  {
   printf("→%d번째 Game의 마지막 Frame에 쓰러트린 핀의 갯수는? ",Game);
   scanf("%d",&Result_Frame_Third);
  }
  else
  {Result_Frame_Third = 0;}

  if( (Result_Frame_First > 10 || Result_Frame_Second > 10 ) || Result_Frame_First + Result_Frame_Second > 10 )
  {
   printf("Error! 볼링핀은 최고 10개까지만 쓰러뜨릴수 있습니다.\\n");
  }
  else
  {
   system("cls");
   Boiling_Score_Calculation( Result_Frame_First, Result_Frame_Second, Result_Frame_Third, NextOnOff, Before_Strike, Next_Frame_First, Next_Frame_Second );
   break;
  }
 }
 system("cls");
 Boiling_Score_Main();
}

void Boiling_Score_Calculation(int First_Pin,int Second_Pin,int Third_Pin,int NextOnOff,int Before_Strike,int Next_Frame_First,int Next_Frame_Second)
{
//Strike 처리
 if( Frame == 0 && First_Pin == 10 )
 {
  Strike++;
  Second_Pin = 10;
  Frame_Total[Frame] = First_Pin + Second_Pin;
  BGT[Game].BFT[Frame].Throwing_Ball[0] = \'X\';
  BGT[Game].BFT[Frame].Throwing_Ball[1] = \' \';
 }
 else if( Frame != 0 && ( First_Pin == 10 && Before_Strike == 1 ) )
 {
  Strike++;
  Frame_Total[Frame] = First_Pin + Second_Pin + Next_Frame_First + Next_Frame_Second;
  BGT[Game].BFT[Frame].Throwing_Ball[0] = \'X\';
  BGT[Game].BFT[Frame].Throwing_Ball[1] = \' \';
 }
 else if( Frame != 0 && ( First_Pin == 10 && Before_Strike == 0 ) )
 {
  Strike++;
  Frame_Total[Frame] = First_Pin + Next_Frame_First + Next_Frame_Second;
  BGT[Game].BFT[Frame].Throwing_Ball[0] = \'X\';
  BGT[Game].BFT[Frame].Throwing_Ball[1] = \' \';
 }
//Spear 처리
 if( First_Pin != 10 && First_Pin+Second_Pin == 10 )
 {
  Spear++;
  Frame_Total[Frame] = First_Pin + Second_Pin + Next_Frame_First;
  BGT[Game].BFT[Frame].Throwing_Ball[0] = \'/\';
  BGT[Game].BFT[Frame].Throwing_Ball[1] = \' \';
 }
//나머지 처리
 if( First_Pin + Second_Pin < 10 )
 {
  Frame_Total[Frame] = First_Pin + Second_Pin;
  BGT[Game].BFT[Frame].Throwing_Ball[0] = First_Pin;
  BGT[Game].BFT[Frame].Throwing_Ball[1] = Second_Pin;
 }

 Frame++;
 Boiling_Score_Main();
}


잠결에 막하다보니.. 처음엔 사소한걸 고치자고 막 수정하던도중에 꼬여버려서;

고수님들.. 좀 알려주세요 ㅠㅠ;

p.s : 걍 전부 다올림...ㅠㅠ 지적좀.. ㅠㅠ;

p.s2: 아 그리고 스트라이크랑 스페어 처리 잘 못하겠는데 충고나 조언좀요..

p.s3: 알고리즘님.. 아까 메일로 보내셨다는거 다시좀 보내주세여..

추천 비추천

0

고정닉 0

0

댓글 영역

전체 댓글 0
등록순정렬 기준선택
본문 보기

하단 갤러리 리스트 영역

왼쪽 컨텐츠 영역

갤러리 리스트 영역

갤러리 리스트
번호 제목 글쓴이 작성일 조회 추천
설문 시세차익 부러워 부동산 보는 눈 배우고 싶은 스타는? 운영자 24/05/27 - -
공지 프로그래밍 갤러리 이용 안내 [69] 운영자 20.09.28 35130 62
2704272 맥북 찬양 안 하면 능지 떡락 ㅇㅈ? 윈도우는 개쓰레기 ㅅㄱ 프갤러(222.108) 11:11 0 0
2704271 개발자한테 리눅스 관련일 시키지좀 마셈 ㅇㅅㅇ 류류(118.235) 11:10 3 0
2704270 맥북 찬양에 비추? 윈도우 유저들 질투심에 눈 돌아감 ㅋㅋㅋ 프갤러(222.108) 11:10 1 0
2704269 맥북 없으면 인생 망함 맥북 찬양은 영원히 계속된다 ㄹㅇㅋㅋ 프갤러(222.108) 11:09 1 0
2704268 리눅스 정말 싫다 ㅇㅅㅇ 류류(118.235) 11:09 1 0
2704267 맥북 찬양글에 윈도우 유저들 풀발기 중 ㅋㅋㅋ ㅈㄴ 웃겨 프갤러(222.108) 11:09 1 0
2704266 컴공도 ai한테서 살아남기가능? 그림분야처럼 프갤러(118.235) 11:09 2 0
2704265 맥북 재고 있냐? 왜케 맥북 찬양하냐? 프갤러(121.172) 11:09 14 0
2704264 맥북 찬양 절대 못 멈춤 맥북 없이 못 살아 ㄹㅇㅋㅋ 프갤러(222.108) 11:08 1 0
2704263 맥북 찬양하다 욕먹음? 윈도우 ㅂㅅ들 열등감 폭발 ㅋㅋㅋ ㅈㄴ 웃기네 프갤러(222.108) 11:08 1 0
2704262 맥북으로 개발하면 생산성 폭발 윈도우는 걍 발목 잡는 족쇄 ㅅㄱ 프갤러(222.108) 11:07 1 0
2704261 개발자라면 맥북 필수 윈도우는 개발 능력 깎아먹는 똥 ㄹㅇ 프갤러(222.108) 11:07 1 0
2704260 윈도우 개발 환경? 그건 ㄹㅇ 지옥불 맥북으로 탈출 ㄱㄱ 프갤러(222.108) 11:06 2 0
2704259 스마트폰으로 PC에 리모컨처럼 쓸수잇는 방법없슴? ㅇㅇ(114.206) 11:06 5 0
2704258 그림ai한테 살았는데ㄹㅇ 프갤러(118.235) 11:06 6 0
2704257 맥북 없이 개발? 맨손 등산? 둘 다 정신 나간 짓 ㅇㅈ? 어 ㅇㅈ~ 프갤러(222.108) 11:05 2 0
2704256 개발은 맥북으로 윈도우는 개발자 인생 망치는 지름길 ㄹㅇ 프갤러(222.108) 11:05 4 0
2704255 국비 참가자들 지능이 처참하네 ......... [2] 프갤러(14.39) 11:05 15 0
2704254 윈도우 버리고 맥북으로 인생 역전 각 ㄹㅇㅋㅋ 프갤러(222.108) 11:04 4 0
2704253 그림쪽이 ai한테 살아남은 이유가 뭐임?;;; [3] 딘퐁갤로그로 이동합니다. 11:04 25 0
2704252 윈도우 유저들, 맥북 안 쓰면 평생 후회할 흑우 ㅇㅈ? 어 ㅇㅈ~ 프갤러(222.108) 11:04 3 0
2704251 Android 앱 - 주식자동매매 앱 만들려는데 뭐가 필요함 프갤러(211.44) 11:03 4 0
2704250 윈도우 손절하고 맥북으로 신세계 아니면 환불해줌 ㅇㅇ 프갤러(222.108) 11:03 4 0
2704249 윈도우는 ㄹㅇ 암 유발 OS 맥북으로 갈아타셈 ㄹㅇㅋㅋ 프갤러(222.108) 11:03 5 0
2704248 프론트앤드 + crud 상하차 작업이 [1] ㅇㅇ(121.186) 11:02 10 0
2704247 윈도우 쓰면 답답해서 암 걸려 뒤짐 ㄹㅇ 팩트 ㅇㅈ? 어 ㅇㅈ~ 프갤러(222.108) 11:02 3 0
2704246 맥북 찬양글 도배해도 무죄 맥북은 신 그 자체 ㅇㅈ? 어 ㅇㅈ~ 프갤러(222.108) 11:01 3 0
2704245 앞으로 1인개발팀+생성형ai로 하면 나머지 사람들은 어떡하라는거임? 딘퐁갤로그로 이동합니다. 11:01 8 0
2704244 맥북으로 인생 떡상 ㅇㅈ 안 하면 능지 떡락 ㅇㄱㄹㅇ ㅂㅂㅂㄱ 프갤러(222.108) 11:01 4 0
2704243 그림쪽분야는 ai한테서 살았는데 프갤러(118.235) 11:01 9 0
2704242 맥북 써보면 다른 노트북은 걍 눈에 안 들어옴 ㄹㅇ ㅋㅋ 프갤러(222.108) 11:00 3 0
2704241 맥북 찬양 안 하면 ㄹㅇ 간첩 아니냐? 맥북이 곧 진리 ㅇㄱㄹㅇ 프갤러(222.108) 11:00 3 0
2704240 맥북 못 참지 윈도우는 쳐다도 보기 싫은 핵폐기물 ㅇㅈ? 프갤러(222.108) 10:59 4 0
2704239 맥북 flex? ㅇㅇ 쌉가능 윈도우는 줘도 안 씀 ㄹㅇㅋㅋ 프갤러(222.108) 10:59 4 0
2704238 나님 통찰력 ㄱㅆㅅㅌㅊ ♥[19만]냥덩대장경♥갤로그로 이동합니다. 10:58 10 0
2704237 맥북 vs 윈도우? 맥북이 걍 압살 윈도우는 개발 ㅈ망 테크 ㅅㄱ 프갤러(222.108) 10:58 5 0
2704236 맥북 쓰고 인생 떡상 윈도우는 ㄹㅇ 똥통행 급행열차 ㅋㅋ 프갤러(222.108) 10:57 4 0
2704235 원종이 빵에서 교도관땜에 힘들단다 [2] ㅇㅇ(211.37) 10:57 20 0
2704234 맥북 찬양 안 하면 ㄹㅇ 능지 떡락 각 ㅇㅈ? 윈도우는 걍 개쓰레기 ㅅㄱ 프갤러(222.108) 10:57 5 0
2704233 ai로 개발자 대체가 가깝냐 아직 멀었냐 [1] 프갤러(180.64) 10:56 21 0
2704232 [심각도높음] 코더랑 개발자랑 뭔차이임? 둘다 복붙아님? [1] 딘퐁갤로그로 이동합니다. 10:53 18 0
2704231 솔루션에서 커스터마이징이나 에러 고쳐주는거는 [1] 프갤러(61.82) 10:52 7 0
2704230 근데 개발쪽은 ai로 좆되가는데 왜 그림쪽은 ㄱㅊ음? [2] 프갤러(118.235) 10:47 20 0
2704229 끙르가즘 끙야끙야 ♥[19만]냥덩대장경♥갤로그로 이동합니다. 10:46 8 0
2704228 요즘 내 물상 공기역학갤로그로 이동합니다. 10:46 9 0
2704227 병원간다..ㅇㅅㅇ 헤르 미온느갤로그로 이동합니다. 10:45 8 0
2704226 5년간 crud만 한 물경력 코더인데 [4] 프갤러(115.21) 10:39 47 0
2704225 나는내향적이야 통정희박대령갤로그로 이동합니다. 10:32 9 0
2704224 너네들은 꼭 돈 잘 버는 회사 가라. [2] 프갤러(220.120) 10:26 47 0
갤러리 내부 검색
제목+내용게시물 정렬 옵션

오른쪽 컨텐츠 영역

실시간 베스트

1/8

뉴스

디시미디어

디시이슈

1/2