#include <iostream>
#include <cmath>
using namespace std;
void task59()
{
cout << "Current date is 11.2019"<<endl;
int currentyear = 2019, currentmonth = 11, bornyear = 1979, bornmonth = 12, age;
if (currentmonth - bornmonth < 0)
age = currentyear - bornyear - 1;
else age = currentyear - bornyear;
cout << "Age is " << age << endl << endl;
}
void task70()
{
cout << "Size of table is 80x60, size of rectangle is 6x10";
int a = 80, b = 60, c = 6, d = 10;
if (((a / c) * (b / d)) > ((b / c) * (a / d)))
cout << "\nAlong the long side";
else if (((a / c) * (b / d)) < ((b / c) * (a / d)))
cout << "\nAlong the short side";
else cout << "\nEqual";
cout << endl << endl;
}
void task81()
{
cout << "angleA = 73, angleB = 17";
int angleA = 73, angleB = 17;
if (angleA + angleB < 180)
{
cout << "\nTriangle exists";
if (angleA == 90 || angleB == 90 || angleA + angleB == 90)
cout << "\nTriangle is right";
else cout << "\nTriangle isn't right";
}
else cout << "\nTriangle doesn't exist";
cout << endl << endl;
}
void task92()
{
cout << "Enter x, then y\n";
double x, y, z;
cin >> x >> y;
if (x > y)
{
cout << "x is " << x << " " << "y is " << y;
}
else
{
if (x < y)
{
z = x, x = y, y = z, cout << "x is " << x << " " << "y is " << y;
}
else if (x == y)
{
cout << "x and y are equal";
}
}
cout << endl << endl;
}
void task103()
{
cout << "a = 4, b = 3, c = 5\n";
int a = 4, b = 3, c = 5;
if (a * a + b * b == c * c)
cout << "Triangle is right, hypotenuse is c";
else if (b * b + c * c == a * a)
cout << "Triangle is right, hypotenuse is a";
else if (c * c + a * a == b * b)
cout << "Triangle is right, hypotenuse is b";
else cout << "a, b and c doesn't compose a right triangle";
cout << endl << endl;
}
void task114()
{
cout << "a = 54.6, b = -190, c = 5.553\n";
double a = 54.6, b = -190, c = 5.553;
if (a <= b && b <= c)
a = a * 2, b = b * 2, c = c * 2;
else a = abs(a), b = abs(b), c = abs(c);
cout << a << " " << b << " " << c << endl << endl;
}
void task125()
{
double number1, number2, number3;
cout << "Enter number1, number2, number3\n";
cin >> number1 >> number2 >> number3;
if (number1 + number1 > 0 || number1 + number3 > 0 || number2 + number3 > 0)
cout << "Sum of two of them is positive";
else cout << "There isn't a positive sum";
cout << endl << endl;
}
void task136()
{
cout << "number1 = 35, number2 = 8\n";
int number1 = 35, number2 = 8;
if (number1 % number2 == 0 || number2 % number1 == 0)
cout << "One of them is divider to another";
else cout << "None of them is divider to other";
cout << endl << endl;
}
void task147()
{
cout << "Enter natural 'n' <= 9999\n";
int n;
cin >> n;
if (n > 0 && n <= 9999)
{
cout << "\nn = " << n << endl;
int thousand = n / 1000, hundred = n % 1000 / 100, dozen = n % 100 / 10, one = n % 10;
if (thousand == hundred && thousand == dozen && dozen == hundred)
cout << "Three numerals of the number are equal";
else if (hundred == dozen && dozen == one && hundred == one)
cout << "Three numerals of the number are equal";
else if (thousand == dozen && thousand == one && dozen == one)
cout << "Three numerals of the number are equal";
else if (thousand == hundred && thousand == one && hundred == one)
cout << "Three numerals of the number are equal";
else cout << "Three numerals of the number aren't equal";
}
else cout << "n doesn't fit the condition";
cout << endl << endl;
}
void task158()
{
double X, Y, Z;
cout << "Enter three real numbers: X, Y, Z\n";
cin >> X >> Y >> Z;
cout << "X = " << X << " Y = " << Y << " Z = " << Z << endl;
if (X + Y + Z < 1)
{
cout << "Sum is less than 1\n";
((X < Y && X < Z) ? X = (Y + Z) / 2 : ((Y < X && Y < Z) ? Y = (X + Z) / 2 : Z = (X + Y) / 2));
}
else { cout << "Sum is more or equal 1\n", (X < Y ? X = (Y + Z) / 2 : Y = (X + Z) / 2); }
cout << "X = " << X << " Y = " << Y << " Z = " << Z << endl <<endl;
}
int main()
{
int a;
while (true)
{
cout << "Numbers of tasks are 59 70 81 92 103 114 125 136 147 158\n";
cin >> a;
cout << endl;
switch (a)
{
case 59:
task59();
break;
case 70:
task70();
break;
case 81:
task81();
break;
case 92:
task92();
break;
case 103:
task103();
break;
case 114:
task114();
break;
case 125:
task125();
break;
case 136:
task136();
break;
case 147:
task147();
break;
case 158:
task158();
break;
case 0:
return(0);
break;
default:
cout << "Incorrect number, try again" << endl;
break;
}
}
}