Created
June 30, 2012 16:35
-
-
Save thetekst/3024557 to your computer and use it in GitHub Desktop.
MyTime Sound on C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <windows.h> // Для Sleep() | |
#include <stdlib.h> // Для кириллицы | |
#include <signal.h> // Библиотека для звуковых сигналов | |
#include <windows.h> // WinApi header file | |
void mySound(void); // Прототип функции | |
int main(int argc, char const *argv[]) | |
{ | |
int minutes; | |
int i; | |
int j; | |
printf("%s", "Input minutes: "); | |
scanf("%d", &minutes); | |
for(i = 0; i < minutes; i++) | |
{ | |
for(j = 0; j < 60; j++)// Цикл выполнится 60 секунд | |
{ | |
Sleep(1000); // 1 секунда | |
printf("%2d\n", j); | |
} | |
system("chcp 65001 > nul"); | |
printf("Прошло %d\n", i+1); | |
} | |
mySound(); | |
printf("\n%s\n", "Time is up!"); | |
return 0; | |
} | |
void mySound(void) | |
{ | |
puts("using winAPI Beep(frequency_hrz, duration_ms)..."); | |
Beep(523,500); // 523 hertz (C5) for 500 milliseconds | |
Beep(587,500); | |
Beep(659,500); | |
Beep(698,500); | |
Beep(784,500); | |
Sleep(500); // 500 ms delay | |
puts("\n\\a makes a beep on the internal speaker too ..."); | |
Sleep(500); | |
puts("\a"); // "\a" - подача звукового сигнала | |
Sleep(500); | |
puts("\a"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment