#include <iostream>
#include <chrono>
#include <thread>
using namespace std;
void beep(int frequency, int duration) {
for (int i = 0; i < duration * frequency / 1000; i++) {
cout << "a";
this_thread::sleep_for(chrono::milliseconds(1));
}
}
int main() {
int melody[] = { 440, 440, 440, 349, 523, 440, 440, 440, 349, 523, 440, 440, 440, 349, 523, 440, 523, 523, 587, 523, 466, 523, 440 };
int duration[] = { 500, 500, 500, 500, 500, 1000, 500, 500, 500, 500, 1000, 500, 500, 500, 500, 1000, 500, 500, 500, 250, 500, 500, 1000 };
int length = sizeof(melody) / sizeof(melody[0]);
for (int i = 0; i < length; i++) {
beep(melody[i], duration[i]);
}
cout << "Selamat ulang tahun!" << endl;
cout << "Semoga panjang umur, sehat selalu, dan sukses dalam segala hal." << endl;
return 0;
}