#include <iostream>
#include <cmath>
using namespace std;
int first()
{
cout << "1." << endl
<< "Введите А:" << endl;
float A;
cin >> A;
float P = (1200 - A) / A;
cout << "Расстояние, которое Коля, в " << P << " раз больше,чем расстояние, пройденное Петей" << endl;
return 0;
}
int second()
float a, b, c, p, s;
cout << "2." << endl
<< "Введите a, b и c:" << endl;
cin >> a >> b >> c;
if (((a + b) > c) and ((a + c) > b) and ((b + c) > a))
p = a + b + c;
s = sqrt((p / 2.0) * (p / 2.0 - a) * (p / 2.0 - b) * (p / 2.0 - c));
cout << "Периметр: " << p << endl
<< "Площадь: " << s << endl;
else
cout << "Такого треугольника не существует!" << endl;
int third()
int a, i, vs[40], ss[40];
char ssc[40];
cout << "3." << endl
<< "Введите число:" << endl;
cin >> a;
int az = a;
i = 0;
cout << "Десятичное:" << endl
<< a << endl;
while (a > 7)
vs[i] = a % 8;
a = a / 8;
i++;
vs[i] = a;
a = az;
cout << "Восьмеричное:" << endl;
for (int k = i; k != -1; k--)
cout << vs[k];
cout << endl;
while (a > 15)
ss[i] = a % 16;
a = a / 16;
ss[i] = a;
for (int k = 0; k < 40; k++)
switch (ss[k])
case 0:
ssc[k] = '0';
break;
case 1:
ssc[k] = '1';
case 2:
ssc[k] = '2';
case 3:
ssc[k] = '3';
case 4:
ssc[k] = '4';
case 5:
ssc[k] = '5';
case 6:
ssc[k] = '6';
case 7:
ssc[k] = '7';
case 8:
ssc[k] = '8';
case 9:
ssc[k] = '9';
case 10:
ssc[k] = 'A';
case 11:
ssc[k] = 'B';
case 12:
ssc[k] = 'C';
case 13:
ssc[k] = 'D';
case 14:
ssc[k] = 'E';
case 15:
ssc[k] = 'F';
cout << "Шестнадцатеричное:" << endl;
cout << ssc[k];
int main()
first();
second();
third();
#include <iostream>
#include <cmath>
using namespace std;
int first()
{
cout << "1." << endl
<< "Введите А:" << endl;
float A;
cin >> A;
float P = (1200 - A) / A;
cout << "Расстояние, которое Коля, в " << P << " раз больше,чем расстояние, пройденное Петей" << endl;
return 0;
}
int second()
{
float a, b, c, p, s;
cout << "2." << endl
<< "Введите a, b и c:" << endl;
cin >> a >> b >> c;
if (((a + b) > c) and ((a + c) > b) and ((b + c) > a))
{
p = a + b + c;
s = sqrt((p / 2.0) * (p / 2.0 - a) * (p / 2.0 - b) * (p / 2.0 - c));
cout << "Периметр: " << p << endl
<< "Площадь: " << s << endl;
}
else
cout << "Такого треугольника не существует!" << endl;
return 0;
}
int third()
{
int a, i, vs[40], ss[40];
char ssc[40];
cout << "3." << endl
<< "Введите число:" << endl;
cin >> a;
int az = a;
i = 0;
cout << "Десятичное:" << endl
<< a << endl;
while (a > 7)
{
vs[i] = a % 8;
a = a / 8;
i++;
}
vs[i] = a;
a = az;
cout << "Восьмеричное:" << endl;
for (int k = i; k != -1; k--)
{
cout << vs[k];
}
cout << endl;
i = 0;
while (a > 15)
{
ss[i] = a % 16;
a = a / 16;
i++;
}
ss[i] = a;
for (int k = 0; k < 40; k++)
{
switch (ss[k])
{
case 0:
ssc[k] = '0';
break;
case 1:
ssc[k] = '1';
break;
case 2:
ssc[k] = '2';
break;
case 3:
ssc[k] = '3';
break;
case 4:
ssc[k] = '4';
break;
case 5:
ssc[k] = '5';
break;
case 6:
ssc[k] = '6';
break;
case 7:
ssc[k] = '7';
break;
case 8:
ssc[k] = '8';
break;
case 9:
ssc[k] = '9';
break;
case 10:
ssc[k] = 'A';
break;
case 11:
ssc[k] = 'B';
break;
case 12:
ssc[k] = 'C';
break;
case 13:
ssc[k] = 'D';
break;
case 14:
ssc[k] = 'E';
break;
case 15:
ssc[k] = 'F';
break;
}
}
cout << "Шестнадцатеричное:" << endl;
for (int k = i; k != -1; k--)
{
cout << ssc[k];
}
cout << endl;
}
int main()
{
first();
second();
third();
}