Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ///////////////////////////////////////////////////////// Lab 2 Ex.4.cpp
- //module Convert;
- import Convert;
- #include <iostream>
- using namespace std;
- int main()
- {
- setlocale(LC_ALL, "Russian");
- int x, chose = 0;
- while (chose == 0 || chose > 6 || chose < 0)
- {
- cout << "1. Годы в дни\n2. Дни в часы\n3. Дни в минуты\n4. Часы в минуты\n5. Часы в секунды\n6. Минуты в секунды\n\nВыбирите действие: ";
- cin >> chose;
- }
- if (chose == 1)
- {
- cout << "\nГода: ";
- cin >> x;
- cout << YearsToDays(x) << " дней\n";
- }
- else if (chose == 2)
- {
- cout << "\nДни: ";
- cin >> x;
- cout << DaysToHour(x) << " часов\n";
- }
- else if (chose == 3)
- {
- cout << "\nДни: ";
- cin >> x;
- cout << DaysToMinutes(x) << " минут\n";
- }
- else if (chose == 4)
- {
- cout << "\nЧасы: ";
- cin >> x;
- cout << HourToMin(x) << " Минут\n";
- }
- else if (chose == 5)
- {
- cout << "\nЧасы: ";
- cin >> x;
- cout << HourToSec(x) << " секунд\n";
- }
- else if (chose == 6)
- {
- cout << "\nМинуты: ";
- cin >> x;
- cout << MinToSec(x) << " секунд\n";
- }
- return 0;
- }
- //////////////////////////////////////////////////////
- ///////////////////////////////////////////////////// Convert.ixx
- #include <iostream>
- export module Convert;
- export int YearsToDays(int x)
- {
- return x * 365;
- }
- export int DaysToHour(int x) // Конвертируем дни в часы
- {
- return 24 * x;
- }
- export int HourToMin(int x)
- {
- return 60 * x;
- }
- export int DaysToMinutes(int x)
- {
- return DaysToHour(HourToMin(x));
- }
- export int MinToSec(int x)
- {
- return 60 * x;
- }
- export int HourToSec(int x)
- {
- return HourToMin(MinToSec(x));
- }
- ///////////////////////////////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement