1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | #include<iostream> using namespace std; void main() { int i = 0; srand((unsigned int)time_t(0)); //Lotto Variable int iLotto[45] = {}; for (i = 0;i < 45;++i) { iLotto[i] = i + 1; // cout << iLotto[i]; } //...Shuttlc Algorithm int iTemp, idx1, idx2; for (int i = 0;i < 100;i++) { idx1 = rand() % 45; idx2 = rand() % 45; iTemp = iLotto[idx1]; iLotto[idx2] = iLotto[idx2]; iLotto[idx2] = iTemp; } for (i = 0;i < 6;++i) { cout<<iLotto[i] << "\t"; } cout << "Bonus Number : " << iLotto[6] << endl; return; } | cs |
'Programming > C & C++' 카테고리의 다른 글
[C++] Bingo Game ver.3 ( AI Ver ) (0) | 2018.02.21 |
---|---|
[C++] Bingo Game ver.2 (0) | 2018.02.20 |
[C++] Bingo Game ver.1 (0) | 2018.02.20 |
[C++]숫자퍼즐게임 (0) | 2018.02.13 |
[C++] BaseBall Game (0) | 2018.02.13 |