디시인사이드 갤러리

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

갤러리 본문 영역

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

Header갤로그로 이동합니다. 2009.06.18 07:20:42
조회 60 추천 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/13 - -
141333 이거맞음? [6] 개쉛기갤로그로 이동합니다. 09.07.28 103 0
141331 핫바리횽...푸푸횽...아니면 JSP 하는 횽들 [2] 캐꼬꼬닭(61.39) 09.07.28 78 0
141330 (토끼풀이)+디씨 댓글 쿨탐은 몇초인가여 ?? [21] 개늅2(61.40) 09.07.28 168 0
141329 토끼 답알려주세요 현기증난단 말이예요 [25] Gromit갤로그로 이동합니다. 09.07.28 215 0
141328 예상질문. 햅틱에 대해 설명하시오. [3] 피로토스갤로그로 이동합니다. 09.07.28 98 0
141327 헉~마돈나 팔이.... [5] 이모군(110.8) 09.07.28 120 0
141326 (정답공개) 아래 별문제 정답은 알았다. [11] ㅇㅇㅃ갤로그로 이동합니다. 09.07.28 179 0
141323 정답은 2라능.. [6] 개쉛기갤로그로 이동합니다. 09.07.28 102 0
141322 ㅇㅇㅃ 훃 밑에 2번째 문제 답이 12인좀확인좀해주세염 [5] 개쉛기갤로그로 이동합니다. 09.07.28 83 0
141321 미쳤어의 글에.. 댓글하나 달았을뿐인데, 차단당했다. [2] Vita500갤로그로 이동합니다. 09.07.28 81 0
141320 CE 5.0 에서 보안설정오류 문제.. [1] 나완전새됐어(61.32) 09.07.28 53 0
141319 횽아들 질문이 있습니다. [14] 쭈중이갤로그로 이동합니다. 09.07.28 98 0
141318 Python에서 tkinter [4] 중달(121.166) 09.07.28 77 0
141317 마소빠용 배경화면 [2] shunman(220.69) 09.07.28 130 0
141316 밥들은 챙겨 먹고 당겨? [2] aspia갤로그로 이동합니다. 09.07.28 82 0
141315 컴공과 4년제나와서 정보보안쪽 전망 좋음? [4] ㅇㅇ(203.81) 09.07.28 199 0
141314 What is my IP address? [3] 중달(121.166) 09.07.28 78 0
141312 마소 엑세스 였다..ㅡ,.ㅡ [1] 개병신(59.20) 09.07.28 72 0
141311 sean,횽의 피니시잇 다운받고 시픈데.. [2] 개늅2(61.40) 09.07.28 57 0
141310 막간을 이용한 퀴즈2 [11] ㅇㅇㅃ갤로그로 이동합니다. 09.07.28 168 0
141309 1부터 100까지 더하는 획기적인 알고리즘이 생각났어 [2] rntjr갤로그로 이동합니다. 09.07.28 121 0
141308 pdf원서로 어셈 공부중인데요. 80x86을 어떻게 읽죠? [3] 한잔의커피갤로그로 이동합니다. 09.07.28 114 0
141306 막간을 이용한 퀴즈 [13] ㅇㅇㅃ갤로그로 이동합니다. 09.07.28 208 0
141305 오늘따라 코드네임 : 잉여킹 횽이 안보이네... [5] 개쉛기갤로그로 이동합니다. 09.07.28 87 0
141304 배차프로그램말이여 [3] 개좆밥(59.20) 09.07.28 70 0
141303 오늘의 초강력 떡밥!!!!!!!!!!!!!!!!!!!!!! [15] Sean.갤로그로 이동합니다. 09.07.28 263 0
141302 취업성공!!!!!!!그러나... [5] ㅇㄹ(152.99) 09.07.28 209 0
141301 nrst횽 봐봐봐ㅗ봐 [2] 개좆밥(59.20) 09.07.28 80 0
141300 가만히 생각해보면 위피가 말이지.. [3] ㅇㅇㅃ갤로그로 이동합니다. 09.07.28 89 0
141299 일베 간 중달횽의 휴대폰 개발자 한풀이 글을 읽고 [2] nRST갤로그로 이동합니다. 09.07.28 118 0
141298 구석횽은 봄미다 [4] nRST갤로그로 이동합니다. 09.07.28 91 0
141297 근데 배차프로그램만드는데 [5] 개좆밥(59.20) 09.07.28 179 0
141296 형들 배차프로그램말이야. [6] 개좆밥(59.20) 09.07.28 134 0
141295 오늘의 유머, "한나라 컴퓨터 열 받아서 투표 오류났을수도" [3] LOO(99.254) 09.07.28 177 0
141294 std::string에 format 함수가 없는 이유 [4] 피로토스갤로그로 이동합니다. 09.07.28 255 0
141293 웹프로그래머가 되고 싶어서 공부하고 있는 학생인데요 [2] 라리리(121.143) 09.07.28 109 0
141291 야구 기사 보다가 느낀건데 [2] ㅇㅇㅃ갤로그로 이동합니다. 09.07.28 70 0
141289 형님들 움짤에 닉네임좀 박아주세요 ㅠㅠ [8] ■탱■구갤로그로 이동합니다. 09.07.28 128 0
141288 홈쇼핑에서 이벤트로 사람 엿먹이는거 어떻게 안되나요? [5] 궁금한거(121.143) 09.07.28 116 0
141287 디씨를 접는게 뭐 어렵다고 그러냐 장애인같은것들아 [3] 개쉛기갤로그로 이동합니다. 09.07.28 97 0
141286 A Question on MySQL setup in Mac [10] algorithm갤로그로 이동합니다. 09.07.28 87 0
141283 키즈라엘, rntjr님 [15] (211.58) 09.07.28 97 0
141282 배틀스타 갤럭티카는 보고 미드얘기 하시나요? [4] ㅇㅇㅃ갤로그로 이동합니다. 09.07.28 69 0
141280 제국의 역습 지금보니까 좀 허접인 듯 [7] 분당살람갤로그로 이동합니다. 09.07.28 154 0
141279 너무 덥다능 [7] algorithm갤로그로 이동합니다. 09.07.28 82 0
141278 내가 웹하는 사람들만 많이 봐서 그런가 [19] 핫바리(124.198) 09.07.28 228 0
141277 내일 SCJP 시험인데.. [4] =^=(211.170) 09.07.28 106 0
141274 개발자들이 사소한걸로 자주 다투긴 한다. [5] yundream(211.189) 09.07.28 174 0
141273 C언어가 구조체로 객체지향을 표현할수 있다던ㄷ [5] 구조체(218.154) 09.07.28 128 0
141271 남동생 VS 형 [5] =^=(211.170) 09.07.28 92 0
갤러리 내부 검색
제목+내용게시물 정렬 옵션

오른쪽 컨텐츠 영역

실시간 베스트

1/8

뉴스

디시미디어

디시이슈

1/2