<pre style="width:1168px;height:250px;border:none;margin-top:0px;margin-bottom:0px;padding:10px 7px;"></pre><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"><span class="cs-default-common-keyword1" style="color:#a71d5d;">do</span></div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;">{</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> turn = t % <span class="cs-default-common-number" style="color:#0099cc;">2</span>;</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> <span class="cs-default-common-keyword1" style="color:#a71d5d;">switch</span> (turn) {</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> <span class="cs-default-common-keyword1" style="color:#a71d5d;">case</span> <span class="cs-default-common-number" style="color:#0099cc;">1</span>:</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> c = NULL;</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> printf(<span class="cs-default-common-string" style="color:#63a35c;">"%d 턴 입니다. O돌을 놓을 좌표를 입력하세요.\n"</span>, t);</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> printf(<span class="cs-default-common-string" style="color:#63a35c;">"세로 좌표 : "</span>);</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> c = getchar();</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> printf(<span class="cs-default-common-string" style="color:#63a35c;">"가로 좌표 : "</span>);</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> scanf_s(<span class="cs-default-common-string" style="color:#63a35c;">"%d"</span>, &j);</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> </div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> <span class="cs-default-common-keyword1" style="color:#a71d5d;">if</span> (c == <span class="cs-default-common-string" style="color:#63a35c;">'a'</span> || c == <span class="cs-default-common-string" style="color:#63a35c;">'A'</span>)</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> i = <span class="cs-default-common-number" style="color:#0099cc;">0</span>;</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> <span class="cs-default-common-keyword1" style="color:#a71d5d;">else</span> <span class="cs-default-common-keyword1" style="color:#a71d5d;">if</span> (c == <span class="cs-default-common-string" style="color:#63a35c;">'b'</span> || c == <span class="cs-default-common-string" style="color:#63a35c;">'B'</span>)</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> i = <span class="cs-default-common-number" style="color:#0099cc;">1</span>;</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> <span class="cs-default-common-keyword1" style="color:#a71d5d;">else</span> <span class="cs-default-common-keyword1" style="color:#a71d5d;">if</span> (c == <span class="cs-default-common-string" style="color:#63a35c;">'c'</span> || c == <span class="cs-default-common-string" style="color:#63a35c;">'C'</span>)</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> i = <span class="cs-default-common-number" style="color:#0099cc;">2</span>;</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"><span style="font-size:9pt;"><br></span></div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"><span style="font-size:9pt;"> a[i][j - </span><span class="cs-default-common-number" style="font-size:9pt;color:#0099cc;">1</span><span style="font-size:9pt;">] = </span><span class="cs-default-common-string" style="font-size:9pt;color:#63a35c;">'O'</span><span style="font-size:9pt;">; </span><span class="cs-default-common-comment" style="font-size:9pt;color:#999999;">//입력한 좌표에 O돌 삽입</span></div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> <span class="cs-default-common-keyword1" style="color:#a71d5d;">break</span>;</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"><br></div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> <span class="cs-default-common-keyword1" style="color:#a71d5d;">case</span> <span class="cs-default-common-number" style="color:#0099cc;">0</span>:</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> c = NULL;</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> printf(<span class="cs-default-common-string" style="color:#63a35c;">"%d 턴 입니다. X돌을 놓을 좌표를 입력하세요.\n"</span>, t);</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> printf(<span class="cs-default-common-string" style="color:#63a35c;">"세로 좌표 : "</span>);</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> c = getchar();</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> printf(<span class="cs-default-common-string" style="color:#63a35c;">"가로 좌표 : "</span>);</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> scanf_s(<span class="cs-default-common-string" style="color:#63a35c;">"%d"</span>, &j);</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> <span class="cs-default-common-keyword1" style="color:#a71d5d;">if</span> (c == <span class="cs-default-common-string" style="color:#63a35c;">'a'</span> || c == <span class="cs-default-common-string" style="color:#63a35c;">'A'</span>)</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> i = <span class="cs-default-common-number" style="color:#0099cc;">0</span>;</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> <span class="cs-default-common-keyword1" style="color:#a71d5d;">else</span> <span class="cs-default-common-keyword1" style="color:#a71d5d;">if</span> (c == <span class="cs-default-common-string" style="color:#63a35c;">'b'</span> || c == <span class="cs-default-common-string" style="color:#63a35c;">'B'</span>)</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> i = <span class="cs-default-common-number" style="color:#0099cc;">1</span>;</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> <span class="cs-default-common-keyword1" style="color:#a71d5d;">else</span> <span class="cs-default-common-keyword1" style="color:#a71d5d;">if</span> (c == <span class="cs-default-common-string" style="color:#63a35c;">'c'</span> || c == <span class="cs-default-common-string" style="color:#63a35c;">'C'</span>)</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> i = <span class="cs-default-common-number" style="color:#0099cc;">2</span>;</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"></div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> a[i][j - <span class="cs-default-common-number" style="color:#0099cc;">1</span>] = <span class="cs-default-common-string" style="color:#63a35c;">'X'</span>; <span class="cs-default-common-comment" style="color:#999999;">//입력한 좌표에 X돌 삽입</span></div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> <span class="cs-default-common-keyword1" style="color:#a71d5d;">break</span>;</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;white-space:pre;height:14px;"> }</div><div style="height:14px;"><font face="Consolas, Liberation Mono, Menlo, Courier, monospace"><span style="line-height:normal;">} while (t <= 9);</span></font></div><div style="height:14px;"><font face="Consolas, Liberation Mono, Menlo, Courier, monospace"><span style="line-height:normal;"><br></span></font></div><div style="height:14px;"><font face="Consolas, Liberation Mono, Menlo, Courier, monospace"><span style="line-height:normal;">처음 실행하면</span></font></div><div style="height:14px;"><font face="Consolas, Liberation Mono, Menlo, Courier, monospace"><span style="line-height:normal;"></span></font><div style="text-align:left;"><img src="http://thimg.todayhumor.co.kr/upfile/201501/1421991610gqlTAkYCaULPFKqVf.png" width="413" height="300" alt="1.png" style="border:none;"></div><div style="text-align:left;"><br></div><div style="text-align:left;">이렇게 세로좌표 값을 잘 받아주는데</div><div style="text-align:left;"><br></div><div style="text-align:left;">그 다음 턴에서는</div><div style="text-align:left;"><div style="text-align:left;"><img src="http://thimg.todayhumor.co.kr/upfile/201501/1421991648wW8p5gm5qSrkruYhbZ8iEj4pjlvWB.png" width="421" height="300" alt="2.png" style="border:none;"></div>이렇게 가로 좌표만 받고 세로좌표는 자기 맘대로 넘어가버립니다. 홀수 턴에서 무조건요</div><div style="text-align:left;">그리고 짝수 턴에서 받았던 입력 그대로 내보내서</div><div style="text-align:left;"><div style="text-align:left;"><img src="http://thimg.todayhumor.co.kr/upfile/201501/1421991758Q2Aw3uopkeeJhgo5jCsNnMUNdf9txyt9.png" width="365" height="236" alt="3.png" style="border:none;"></div><div style="text-align:left;">2턴에서 가로좌표만 2를 입력해서 나온 값입니다. 세로좌표는 받지도 않구 넘어가서요..</div><div style="text-align:left;"><br></div><div style="text-align:left;">이거 어떻게 해야 짝수 턴에서도 세로좌표를 제대로 받을 수 있을까요?</div><div style="text-align:left;"><br></div><div style="text-align:left;">혹시나 해서 제가 1턴에 좌표 받는 순서를 바꿔봤습니다</div><div style="text-align:left;"><pre style="line-height:18px;width:1168px;height:250px;border:none;margin-top:0px;margin-bottom:0px;padding:10px 7px;"></pre><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;height:14px;">printf(<span class="cs-default-common-string" style="color:#63a35c;">"%d 턴 입니다. O돌을 놓을 좌표를 입력하세요.\n"</span>, t);</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;height:14px;"> printf(<span class="cs-default-common-string" style="color:#63a35c;">"가로 좌표 : "</span>);</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;height:14px;"> scanf_s(<span class="cs-default-common-string" style="color:#63a35c;">"%d"</span>, &j);</div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;height:14px;"><span style="font-size:9pt;"><span class="Apple-tab-span" style="white-space:pre;"> </span>printf(</span><span class="cs-default-common-string" style="font-size:9pt;color:#63a35c;">"세로 좌표 : "</span><span style="font-size:9pt;">);</span></div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;height:14px;"><span style="font-size:9pt;"><span class="Apple-tab-span" style="white-space:pre;"> </span>c = getchar();</span></div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;height:14px;"><span style="font-size:9pt;">이렇게요.</span></div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;height:14px;"><span style="font-size:9pt;">그랬더니 가로좌표만 받고 세로좌표 받을 차례에 에러가 뜨면서 프로그램이 종료되요 ㅠㅠ </span></div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;height:14px;"><span style="font-size:9pt;"></span><div style="text-align:left;"><img src="http://thimg.todayhumor.co.kr/upfile/201501/1421992011Zq5445jrJ89KkPTW5kAxT1RrKH.png" width="612" height="381" alt="4.png" style="border:none;"></div><br></div><div style="font-family:Consolas, 'Liberation Mono', Menlo, Courier, monospace;line-height:normal;height:14px;"><span style="font-size:9pt;">문제가 뭐죠?? ㅠㅠㅠ</span></div></div></div><br></div><div style="height:14px;"><font face="Consolas, Liberation Mono, Menlo, Courier, monospace"><span style="line-height:normal;"><br></span></font></div>
댓글 분란 또는 분쟁 때문에 전체 댓글이 블라인드 처리되었습니다.