Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <windows.h>
- #include <iostream>
- #include <conio.h>
- using namespace std;
- #pragma warning(default:4716)
- class Music {
- public:
- int Snd[13];
- int Sund_spd;
- Music(void)
- {
- Snd[0] = 262;
- Snd[1] = 277;
- Snd[2] = 294;
- Snd[3] = 311;
- Snd[4] = 330;
- Snd[5] = 349;
- Snd[6] = 370;
- Snd[7] = 392;
- Snd[8] = 415;
- Snd[9] = 440;
- Snd[10] = 466;
- Snd[11] = 494;
- Snd[12] = 523;
- Sund_spd = 150;
- }
- char PianoGunban(void)
- {
- int i = 1;
- while (i)
- {
- int n = getch();
- switch (n){
- case 'A':
- case 'a':
- Beep(Snd[0], Sund_spd);
- break;
- case 'w':
- case 'W':
- Beep(Snd[1], Sund_spd);
- break;
- case 's':
- case 'S':
- Beep(Snd[2], Sund_spd);
- break;
- case 'e':
- case 'E':
- Beep(Snd[3], Sund_spd);
- break;
- case 'D':
- case 'd':
- Beep(Snd[4], Sund_spd);
- break;
- case 'F':
- case 'f':
- Beep(Snd[5], Sund_spd);
- break;
- case 't':
- case 'T':
- Beep(Snd[6], Sund_spd);
- break;
- case 'g':
- case 'G':
- Beep(Snd[7], Sund_spd);
- break;
- case 'y':
- case 'Y':
- Beep(Snd[8], Sund_spd);
- break;
- case 'h':
- case 'H':
- Beep(Snd[9], Sund_spd);
- break;
- case 'U':
- case 'u':
- Beep(Snd[10], Sund_spd);
- break;
- case 'j':
- case 'J':
- Beep(Snd[11], Sund_spd);
- break;
- case 'K':
- case 'k':
- Beep(Snd[12], Sund_spd);
- break;
- case 27:
- system("cls");
- i--;
- break;
- }
- }
- }
- int Papper_Air(void)
- {
- Beep(Snd[3], Sund_spd);
- Beep(Snd[2], Sund_spd);
- Beep(Snd[1], Sund_spd);
- Beep(Snd[2], Sund_spd);
- Beep(Snd[3], Sund_spd);
- Beep(Snd[3], Sund_spd);
- Beep(Snd[3], Sund_spd);
- Sleep(200);
- Beep(Snd[2], Sund_spd);
- Beep(Snd[2], Sund_spd);
- Beep(Snd[2], Sund_spd);
- Sleep(200);
- Beep(Snd[3], Sund_spd);
- Beep(Snd[3], Sund_spd);
- Beep(Snd[3], Sund_spd);
- Sleep(200);
- Beep(Snd[3], Sund_spd);
- Beep(Snd[2], Sund_spd);
- Beep(Snd[1], Sund_spd);
- Beep(Snd[2], Sund_spd);
- Beep(Snd[3], Sund_spd);
- Beep(Snd[3], Sund_spd);
- Beep(Snd[3], Sund_spd);
- Sleep(200);
- Beep(Snd[2], Sund_spd);
- Beep(Snd[2], Sund_spd);
- Beep(Snd[3], Sund_spd);
- Beep(Snd[2], Sund_spd);
- Beep(Snd[1], Sund_spd);
- }
- };
- class Menu{
- private:
- int Drow_Menu(void)
- {
- system("cls");
- cout << endl << endl << endl << endl << endl << endl;
- cout << " ┏━━━━━━━━━━━━★" << endl;
- cout << " ┃ 디지털 피아노 프로그램 ┃" << endl;
- cout << " ┗━━━━━━━━━━━━┛" << endl;
- cout << endl << endl << endl << endl << endl << endl;
- cout << " ┏━━━━━━━★" << endl;
- cout << " ┃ 1. 연주 하기 ┃" << endl;
- cout << " ┃ 2. 연주 듣기 ┃" << endl;
- cout << " ┃ ┃" << endl;
- cout << " ┃ 3. 나 가 기 ┃" << endl;
- cout << " ┗━━━━━━━┛" << endl;
- }
- int Drow_Piano(void)
- {
- system("cls");
- cout << " _____________________________________________________________________________★" << endl;
- cout << " 1. 연주하기 " << endl;
- cout << " _____________________________________________________________________________" << endl;
- cout << endl;
- cout << " ━┳━┳━━┳┳━━┳━━┳━┳━━┳┳━━┳┳━━┳━━┳━━━┳━" << endl;
- cout << " ┃ ┃ ┃┃ ┃ ┃ ┃ ┃┃ ┃┃ ┃ ┃ ┃ " << endl;
- cout << " ┃ ┃ ┃┃ ┃ ┃ ┃ ┃┃ ┃┃ ┃ ┃ ┃ " << endl;
- cout << " ┃ ┃ ┃┃ ┃ ┃ ┃ ┃┃ ┃┃ ┃ ┃ ┃ " << endl;
- cout << " ┃ ┃ ┃┃ ┃ ┃ ┃ ┃┃ ┃┃ ┃ ┃ ┃ " << endl;
- cout << " ┃ ┃ ┃┃ ┃ ┃ ┃ ┃┃ ┃┃ ┃ ┃ ┃ " << endl;
- cout << " ┃ ┃도# ┃┃레# ┃ ┃ ┃파# ┃┃솔# ┃┃라# ┃ ┃ ┃ " << endl;
- cout << " ┃ ┃ w ┃┃ e ┃ ┃ ┃ t ┃┃ y ┃┃ u ┃ ┃ ┃ " << endl;
- cout << " ┃ ┗━┳┛┗━┳┛ ┃ ┗━┳┛┗━┳┛┗━┳┛ ┃ ┃ " << endl;
- cout << " ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ ┃ " << endl;
- cout << " ┃ [도] ┃ [레] ┃ [미] ┃ [파] ┃ [솔] ┃ [라] ┃ [시] ┃ [도] ┃ " << endl;
- cout << " ┃ a ┃ s ┃ d ┃ f ┃ g ┃ h ┃ j ┃ k ┃ " << endl;
- cout << " ━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━━━┻━" << endl;
- cout << " _____________________________________________________________________________" << endl;
- cout << endl << endl << endl;
- cout << " _____________________________________________________________________________" << endl;
- cout << " 나가기 - ESC " << endl;
- cout << " _____________________________________________________________________________";
- }
- int Drow_Note(void)
- {
- system("cls");
- cout << " __________________________________________________________________________★" << endl;
- cout << " 2. 음악듣기 " << endl;
- cout << " ____________________________________________________________________________" << endl;
- cout << endl;
- cout << " " << endl;
- cout << " ****** " << endl;
- cout << " ******* " << endl;
- cout << " ********* " << endl;
- cout << " **** *** " << endl;
- cout << " **** *** " << endl;
- cout << " **** *** " << endl;
- cout << " **** *** " << endl;
- cout << " **** ** " << endl;
- cout << " **** ** " << endl;
- cout << " ******* " << endl;
- cout << " ********** " << endl;
- cout << " *********** " << endl;
- cout << " ********* " << endl;
- cout << " ******* " << endl;
- cout << endl << endl;
- cout << " ____________________________________________________________________________" << endl;
- cout << " 나가기 - ESC " << endl;
- cout << " ____________________________________________________________________________";
- }
- public:
- int exit;
- int Main_Menu(void)
- {
- Drow_Menu();
- char Menu_num = getch();
- Music sound;
- switch (Menu_num)
- {
- case '1':
- Drow_Piano();
- sound.PianoGunban();
- break;
- case '2':
- Drow_Note();
- sound.Papper_Air();
- getch();
- break;
- case '3':
- exit = 0;
- break;
- }
- }
- };
- int main(void)
- {
- Menu Call;
- Call.exit = 1;
- while (Call.exit)
- {
- Call.Main_Menu();
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment