#include #include #include #include // sndPlaySound¸¦ ½ÇÇàÇϱâ À§ÇÑ Çì´õÆÄÀÏ #pragma comment(lib, "winmm.lib") // sndPlaySound¸¦ ½ÇÇàÇϱâ À§ÇÑ ¶óÀ̺귯¸® void SetCurrentCursorPos(int x, int y) // Ä¿¼­ À§Ä¡¸¦ ÁöÁ¤ÇØÁÖ´Â ÇÔ¼ö { COORD pos={x, y}; SetConsoleCursorPosition(GetStdHandle(STD_OUTPUT_HANDLE), pos); } void RemoveCursor() // Ä¿¼­¸¦ Áö¿öÁÖ´Â ÇÔ¼ö { CONSOLE_CURSOR_INFO curInfo; GetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &curInfo); curInfo.bVisible=0; SetConsoleCursorInfo(GetStdHandle(STD_OUTPUT_HANDLE), &curInfo); } void Delete(int a, int b) // ¢ÑÀ» Áö¿öÁÖ´Â ÇÔ¼ö { SetCurrentCursorPos(a, b); printf(" "); } void Menu(int a, int b) { system("cls"); RemoveCursor(); SetCurrentCursorPos(8, 2); printf("Game Start"); SetCurrentCursorPos(8, 4); printf("Choose song"); SetCurrentCursorPos(8, 6); printf("Exit Game"); SetCurrentCursorPos(a, b); printf("¢Ñ"); } void main() { int a=3, b=2; char c; Menu(a,b); for(;;) { if(_kbhit() != 0) { c = _getch(); if(c==72) { Delete(a, b); if(b==2) b=6; else b-=2; SetCurrentCursorPos(a, b); printf("¢Ñ"); } else if(c==80) { Delete(a, b); if(b==6) b=2; else b+=2; SetCurrentCursorPos(a, b); printf("¢Ñ"); } else if(c==13) { if(b == 2) { system("cls"); printf("Start Game\n"); printf("3ÃÊ µÚ¿¡ ¸ÞÀÎ ¸Þ´º·Î µ¹¾Æ°©´Ï´Ù.\n"); Sleep(3000); Menu(a, b); }else if(b == 4) { system("cls"); printf("Press 'q' to exit"); sndPlaySound(TEXT("c:\\ttt.wav"),SND_ASYNC); do { c = _getch(); } while(c != 'q'); // q¸¦ ´©¸£¸é Á¾·á sndPlaySound(NULL, SND_ASYNC); printf("Á¾·á\n"); Menu(a, b); }else if(b == 6) { system("cls"); printf("Good bye~~~\n"); Sleep(1000); exit(0); } } } } }