Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <math.h>
- #include <conio.h>
- #include <stdio.h>
- #include <time.h>
- #include <Windows.h>
- unsigned int time_sec(unsigned int h, unsigned int m, unsigned int s);
- int main() {
- SetConsoleCP(1251);
- SetConsoleOutputCP(1251);
- srand(time(0));
- int a = time_sec(10, 15, 36);
- int b = time_sec(14, 59, 23);
- printf("Кіл-сть секунд першого моменту часу: %d\n", a);
- printf("Кіл-сть секунд другого моменту часу: %d\n\n", b);
- if (a > b)
- printf("Oбчислення проміжку часу у секундах між двома моментами: %d", a - b);
- else
- printf("Oбчислення проміжку часу у секундах між двома моментами: %d", b - a);
- _getch();
- return 0;
- }
- unsigned int time_sec(unsigned int h, unsigned int m, unsigned int s)
- {
- return (h % 12) * 3600 + m * 60 + s;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement