Study minigame bslime 2008. 9. 28. 23:59 #include <iostream> #include <ctime> #include <cstdlib> using namespace std; #define chance 10 int game1(); int main(void) { game1(); return 0; } int game1(void) { srand(static_cast<unsigned int>(time(0))); int number; int input; int count; number = rand()%999; cout << "Enter number (range 0~999)" << endl; for(count = 0; count <= chance; count++) { if (count == chance) { cout << "Game Over :p" << endl; exit(0); } cout << "You have " << chance-count << " chance : "; cin >> input; if (input > number) cout << "number is bigger than key" << endl; else if (input < number) cout << "number is lower than key" << endl; else if (input == number) { cout << "Congratulation! The number is " << number << " !!" << endl; exit(0); } } return 0; } 간단하고 재밌는거 몇개 더 추가해서, 내년에 워게임용 자료로나 써볼까 -_-)