online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code   
Language
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <iostream> #include <random> using namespace std; int getRandomNumber (int min, int max) { // 씨드 설정 random_device rd; mt19937 seed(rd()); //분포 설정 uniform_int_distribution<int> range(min, max); //랜덤 값 생성 return range(seed); } int main() { const int MIN = 1; const int MAX = 45; int arr[MAX+1]; int pickedBall; // 초기화 작업 for (int i=MIN; i<=MAX; i=i+1) { arr[i] = 0; } // 총 7개의 수를 뽑음 for (int i=1; i<=7; i++) { while(true) { pickedBall = getRandomNumber(MIN, MAX); if (arr[pickedBall]==0) { // 이전에 뽑았는지 확인 break; // 뽑은 적이 없다면 OK } } if (i==7) { cout << " (BONUS: " << pickedBall << ")" << endl; } else { arr[pickedBall] = 1; // 뽑았다고 표시 cout << pickedBall << " "; } } 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