Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save Denkotleta221/c3d7d461c257ada46d2067260ba536bf to your computer and use it in GitHub Desktop.
Save Denkotleta221/c3d7d461c257ada46d2067260ba536bf to your computer and use it in GitHub Desktop.
#include <iostream>
#include <windows.h>
using namespace std;
int main()
{
setlocale(LC_ALL, "RU");
SetConsoleOutputCP(CP_UTF8);
SetConsoleCP(CP_UTF8);
// 1) Task
/*double rad;
cout << "Enter radius of circle: ";
cin >> rad;
double s = 3.14f * rad * rad;
double p = 2 * 3.14f * rad;
cout << "Area: " << s << "\n";
cout << "Circumference length: " << p << "\n";*/
// 2) Task
/*int a = 1;
int b = 2;
int c = a;
a = b;
b = c;
cout << a << " " << b;*/
// 3) Task
/*double money;
cout << "Enter your money: ";
cin >> money;
int hryvnia = money;
double cent = (money - (int)money) * 100;
cout << "Hryvien: " << hryvnia << "\tCents: " << cent;*/
// 4) Task
/*int time;
cout << "Enter time in secods: ";
cin >> time;
int day = time / 86400;
int hour = (time % 86400) / 3600;
int minutes = (time % 3600) / 60;
int seconds = time % 60;
cout << "Days: " << day << "\nHours: " << hour << "\nMinutes: " << minutes << "\nSeconds: " << seconds;*/
// 5) Task
int start_hours, start_minutes, start_seconds;
cout << "Enter start calling(hours): ";
cin >> start_hours;
cout << "Enter start calling(minutes): ";
cin >> start_minutes;
cout << "Enter start calling(seconds): ";
cin >> start_seconds;
int end_hours, end_minutes, end_seconds;
cout << "Enter end calling(hours): ";
cin >> end_hours;
cout << "Enter end calling(minutes): ";
cin >> end_minutes;
cout << "Enter end calling(seconds): ";
cin >> end_seconds;
int time_call_hours = end_hours - start_hours;
int time_call_minutes = end_minutes - start_minutes;
int time_call_seconds = end_seconds - start_seconds;
int money_hours = (time_call_hours * 60) * 15;
int money_minutes = time_call_minutes * 15;
int money_seconds = time_call_seconds * 4;
int money_call = money_hours + money_minutes + money_seconds;
cout << "Cost for calling: " << money_call;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment