Advertisement
iStrzalka

Uro

Apr 19th, 2018
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.05 KB | None | 0 0
  1. #include <iostream>
  2. #include <random>
  3. #include <algorithm>
  4. #include <windows.h>
  5. #include <cwchar>
  6.  
  7. #define D 1174
  8. #define E 1318
  9. #define G 1567
  10. #define Fmol 1479
  11. #define B 1975
  12. #define C7 2093
  13. #define A 1760
  14. #define msg "HAPPY BIRTHDAY"
  15.  
  16.  
  17. using namespace std;
  18.  
  19. int main()
  20. {
  21.     HANDLE hConsole=GetStdHandle(STD_OUTPUT_HANDLE);
  22.  
  23.     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};
  24.     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};
  25.  
  26.     while(1)
  27.     {
  28.         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};
  29.         random_shuffle(when, when+26);
  30.         int j = 0;
  31.         for(int i = 0; i < 26; i++)
  32.         {
  33.             SetConsoleTextAttribute(hConsole, (int) (rand() % 10 + 1) | FOREGROUND_INTENSITY);
  34.             Beep(sound[i], 500 * Beats[i]);
  35.             if(when[i])
  36.                 cout << msg[j++];
  37.         }
  38.         cout << "\n";
  39.     }
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement