Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <random>
- #include <algorithm>
- #include <windows.h>
- #include <cwchar>
- #define D 1174
- #define E 1318
- #define G 1567
- #define Fmol 1479
- #define B 1975
- #define C7 2093
- #define A 1760
- #define msg "HAPPY BIRTHDAY"
- using namespace std;
- int main()
- {
- HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
- int sound[] = {D, D, E, D, G, Fmol, D, D, E, D, A, G, D, D, 2349, B, G, Fmol, E, C7, C7, B, G, A, G, A};
- double Beats[] = {3.0/4, 1.0/4, 1.0, 1.0, 1.0, 1.5, 3.0/4, 1.0/4, 1.0, 1.0, 1.0, 1.5, 3.0/4, 1.0/4, 1.0, 1.0, 1.0, 1.5, 3.0/4, 1.0/4, 1.0, 1.0, 1.0, 1.5, 1.5};
- while(1)
- {
- int when[26] = {1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,0,0,0,0,0,0};
- random_shuffle(when, when+26);
- int j = 0;
- for(int i = 0; i < 26; i++)
- {
- SetConsoleTextAttribute(hConsole, (int) (rand() % 10 + 1) | FOREGROUND_INTENSITY);
- Beep(sound[i], 500 * Beats[i]);
- if(when[i])
- cout << msg[j++];
- }
- cout << "\n";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement