online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
#pragma warning(disable:4996) // scanf() λ³΄μ•ˆ κ²½κ³  λΉ„ν™œμ„±ν™” #include <stdio.h> // ν‘œμ€€ μž…μΆœλ ₯ κ΄€λ ¨ κΈ°λŠ₯을 μ œκ³΅ν•˜λŠ” 헀더 파일 #include <stdlib.h> // ν‘œμ€€ 라이브러리 ν•¨μˆ˜ #include <time.h> // λ‚ μ§œμ™€ μ‹œκ°„ κ΄€λ ¨ κΈ°λŠ₯을 μ œκ³΅ν•˜λŠ” 헀더 파일 int throwDice(); // 1~6 사이 λ‚œμˆ˜λ₯Ό λ°˜ν™˜ν•˜λŠ” ν•¨μˆ˜ int getUserGuess(); // μ‚¬μš©μžλ‘œλΆ€ν„° 숫자λ₯Ό μž…λ ₯λ°›λŠ” ν•¨μˆ˜ void playGuessingGame(); // μ£Όμ‚¬μœ„ 맞히기 κ²Œμž„ μ‹€ν–‰ ν•¨μˆ˜ int throwDice(){ // 1λΆ€ν„° 6κΉŒμ§€μ˜ λ¬΄μž‘μœ„ 숫자 λ°˜ν™˜ return rand() % 6 + 1; } int getUserGuess(){ // μž…λ ₯받은 숫자λ₯Ό λ°˜ν™˜ int guess; printf("μ£Όμ‚¬μœ„λ₯Ό 던져 λ‚˜μ˜¬ 숫자λ₯Ό λ§žν˜€λ³΄μ„Έμš” (1μ—μ„œ 6κΉŒμ§€): "); scanf("%d", &guess); return guess; } void playGuessingGame(){ // μ£Όμ‚¬μœ„ 맞히기 κ²Œμž„ 둜직 int userGuess, diceResult; // μ‚¬μš©μžκ°€ 0을 μž…λ ₯ν•  λ•ŒκΉŒμ§€ κ²Œμž„μ„ λ°˜λ³΅ν•˜κΈ° μœ„ν•œ do~while λ¬Έ 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