online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#include <stdio.h> // 표준 입출력 관련 기능을 제공하는 헤더 파일일 #include <stdlib.h> // 표준 라이브러리 함수수 #include <time.h> // 날짜와 시간 관련 기능을 제공하는 헤더 파일일 #pragma warning(disable:4996) int throwDice(); int getUserGuess(); // 사용자 정의 함수 선언언 void playGuessingGame(); int throwDice() { return rand() % 6 + 1; } int getUserGuess() { int guess; printf("주사위를 던져 나올 숫자를 맞혀보세요 (1에서 6까지): "); scanf("%d", &guess); return guess; } void playGuessingGame() { int userGuess, diceResult; /* while(1){ userGuess = getUserGuess(); if(userGuess == 0) { printf("게임을 종료합니다.\n"); break; }else if(!(userGuess >= 1 && userGuess <= 6)) { printf("잘못된 값을 입력하셨습니다.\n"); continue; } } 위 while문 사용 시 아래 문장 빼기 do { userGuess = getUserGuess(); */ do { userGuess = getUserGuess(); diceResult = throwDice(); printf("주사위 결과: %d\n", diceResult); if (userGuess == diceResult) { printf("축하합니다! 숫자를 맞혔습니다. \n"); } else { printf("아쉽습니다. 다시 시도하세요.\n"); } } while (userGuess != 0); } int main() { srand(time(NULL)); // 난수 발생 초기화 printf("주사위 숫자 맞히기 게임을 시작합니다.\n"); playGuessingGame(); printf("게임 종료\n"); return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue