workspace/02/02_69p.c
2026-03-31 09:16:35 +09:00

30 lines
No EOL
657 B
C

#include <stdio.h>
#include <windows.h>
#define C 1046.502
#define D 1108.731
#define E 1318.510
#define F 1396.913
#define G 1567.982
#define A 1760.000
#define B 1975.533
int main() {
int notes[] = {
G, G, A, A, G, G, E, G, G, E, E, D,
G, G, A, A, G, G, E, G, E, D, E, C
};
int noteDelays[] = {
200, 200, 200, 200, 200, 200, 400, 200, 200, 200, 200, 500,
200, 200, 200, 200, 200, 200, 400, 200, 200, 200, 200, 500
};
int i;
for (i = 0; i < (int)(sizeof(notes) / sizeof(notes[0])); i++) {
Beep(notes[i], 500);
Sleep(noteDelays[i]);
}
system("pause");
return 0;
}