디시인사이드 갤러리

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

갤러리 본문 영역

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

Header갤로그로 이동합니다. 2009.06.18 07:20:42
조회 65 추천 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
본문 보기

하단 갤러리 리스트 영역

왼쪽 컨텐츠 영역

갤러리 리스트 영역

갤러리 리스트
번호 제목 글쓴이 작성일 조회 추천
설문 현역으로 군대 안 간게 의아한 스타는? 운영자 25/06/30 - -
공지 프로그래밍 갤러리 이용 안내 [88] 운영자 20.09.28 45075 65
2868989 러스팅 소울 3장: 균열의 시작 루비갤로그로 이동합니다. 01:44 7 0
2868986 드라이버 쇼트로 자주 부팅해서 파워가 얼마나 버틸까요. 쇼트 나고 탄내 [1] 넥도리아(121.139) 01:28 10 0
2868983 Fg ㅇㅇ(223.38) 00:45 14 0
2868982 Hh ㅇㅇ(223.38) 00:44 13 0
2868981 Hg ㅇㅇ(223.38) 00:44 13 0
2868980 그니까 이거지 이제 프로그래머로써의 가치는 LLM보다 뛰어나야하는데 [1] ㅆㅇㅆ(124.216) 00:24 26 0
2868979 Msinfo System Driver만 완벽히 알면 그 외 넥도리아(121.139) 00:23 17 0
2868977 취업할 때 꿀팁 ㅇㅇ(211.235) 00:18 19 0
2868976 Tuf 장치 암호화 immou 많이도 배운다. msinfo 넥도리아(121.139) 00:18 11 0
2868974 기대치가 크면 너무... 넥도리아(121.139) 00:10 19 0
2868973 내가 죄졌나... 커널 암호화해제만 되었을 뿐인데... 넥도리아(121.139) 00:05 23 0
2868971 요즘 mz들은 왜 회식 싫어함? [7] ㅇㅇ(211.235) 00:04 55 2
2868970 여기 토익 800넘는사람있냐? 프갤러(211.235) 00:02 20 0
2868968 요즘 느끼는게 프로그래밍 실력 늘리는게 아니라, RAG 키우기 해야하는 [1] ㅆㅇㅆ(124.216) 07.01 40 0
2868967 IEChooser 넥도리아(175.196) 07.01 13 0
2868966 호갱되지않으려면 무조건 알고있어야함 ㅇㅇㅇㅇ(49.254) 07.01 25 0
2868965 요새 프로그래밍 최신 기술 서들 대부분 AI쪽이라서 ㅆㅇㅆ(124.216) 07.01 31 0
2868964 증거가 없으면 진짜 증거불충분으로 풀려나?? [2] ㅇㅇ(223.38) 07.01 29 0
2868963 OS가 운영체제가 저 명령 단축키를 거부합니다. 넥도리아(175.196) 07.01 17 0
2868962 Si 회사에서 서비스로 이직 준비중인데 서탈 30개면 포기하는게 맞지? [2] 프갤러(211.36) 07.01 35 0
2868959 불법 바이럴의 최고 수혜자는 과연 누구? ㅇㅇ(110.70) 07.01 24 0
2868956 알리 이새끼들은 왜 다이소보다 싸게팔수있는거냐 ㅇㅇ [1] 뒷통수한방(1.213) 07.01 27 0
2868954 고3 금융권 IT쪽으로 가고싶은데 시험끝나고 해야할 공부랑 질문 [8] 프갤러(1.245) 07.01 83 0
2868952 대구 다음주 낮기온 39도네 [2] 야옹아저씨갤로그로 이동합니다. 07.01 42 0
2868947 너네 근데 AI 토큰으로 쓰냐 정액제로 쓰냐 [2] ㅆㅇㅆ(124.216) 07.01 42 0
2868945 아 나는 왜 이렇게 천재일까 [4] 아스카영원히사랑해갤로그로 이동합니다. 07.01 54 1
2868943 이거 지울까요 윈도우 파일 디렉토리에서 넥도리아(175.196) 07.01 27 0
2868941 MCP로 바이브 코딩 해보고 이거 못쓰겠다 그냥 [5] ㅆㅇㅆ(124.216) 07.01 68 0
2868939 두고두고 필요한 꿀팁 모음 ㅇㅇㅇㅇ(124.198) 07.01 24 0
2868938 이런 여성스타일 어떻냐? [5] 헬마스터갤로그로 이동합니다. 07.01 68 0
2868936 도서관에 책 빌려보는거 괜찮음? [4] 프갤러(121.179) 07.01 44 0
2868934 인공지능안하고 그냥 개발자 할거면 머신러닝,딥러닝 이런거 안해도 됨? 프갤러(118.131) 07.01 21 0
2868932 기분이 좋을땐 냥덩이 흔들어봥~❤ ♥냥덩이♥갤로그로 이동합니다. 07.01 28 0
2868930 책상 이쁘게 꾸미시는분!? 입문자(220.79) 07.01 39 0
2868928 난 무슨 느낌을 찾아 이렇게 방황하는걸까... 뭘 찾고 싶은거지 ㅇㅇ(223.38) 07.01 17 0
2868927 MSI 모니터 MD271UL 7월 중순 입고 실화냐? [1] 루비갤로그로 이동합니다. 07.01 29 0
2868924 3.2mb 공간이 없어서 정적링킹은 안된다는 거지는 또 처음보네 프갤러(110.8) 07.01 36 1
2868922 내일까지 내야하는데 빌드만 하면 찐빠가 난다. 문제는 빌드하는데 ㅆㅇㅆ(124.216) 07.01 28 0
2868921 ibus 바이너리 크기) 러스트는 진짜 정신병이다.. 노답이다. [4] 루비갤로그로 이동합니다. 07.01 61 0
2868919 ㅆㅇㅆ봐라 [3] 배구공(119.202) 07.01 102 2
2868918 am4, 메모리 소켓 4, 고주파 없는 보드 추천 좀 [2] 루비갤로그로 이동합니다. 07.01 30 0
2868917 홈서버 도로 돌려야겠다 루비갤로그로 이동합니다. 07.01 22 0
2868916 냥덩이를 살려주세양❤+ [2] ♥냥덩이♥갤로그로 이동합니다. 07.01 62 0
2868915 취업볼때 팀플경험도 많이 보냐 [2] ㅇㅇ갤로그로 이동합니다. 07.01 78 0
2868914 러스트 비판서를 유튜브 댓글에 한/영/중 링크 루비갤로그로 이동합니다. 07.01 15 0
2868913 근데 궁금한게 대체 얼마나 조현병자여야 나를 8개월 따라다니냐 [1] ㅆㅇㅆ(124.216) 07.01 68 0
2868912 오늘은 편안한 마음으로 책이나 다듬어야지 루비갤로그로 이동합니다. 07.01 16 0
2868911 디시 댓글 자동으로 달리게 하는거 가능함? [1] 프갤러(211.33) 07.01 27 0
2868910 좇센만큼 살기좋은나라가 어딨음 ㅋㅋ 뒷.통수한방(1.213) 07.01 19 0
뉴스 스트레이 키즈 리노, 구찌 글로벌 앰버서더 발탁 디시트렌드 07.01
갤러리 내부 검색
제목+내용게시물 정렬 옵션

오른쪽 컨텐츠 영역

실시간 베스트

1/8

뉴스

디시미디어

디시이슈

1/2