#include <iostream>
#include <conio.h>
#include <clocale>
#include <stdlib.h>
#include <stdio.h>
#include <math.h>
#include <Windows.h>
using namespace std;
int main()
{
setlocale(0, "");
SetConsoleCP(1251);
SetConsoleOutputCP(1251);
int t, p = 0;
while (p == 0)
{
system("cls");
cout << "1. задача из лабораторной 1\n";
cout << "2. задача из лабораторной 2\n";
cout << "3. задача из лабораторной 3\n";
cout << "4. задача из лабораторной 4\n";
cout << "5. задача из лабораторной 5\n";
cout << "6. выход из меню\n";
cout << "Введите номер задачи, которую хотите открыть --> ";
cin >> t;
switch (t) // меню выбора задачи
{
case 1: cout << "задача из лабораторной 1"; system("pause"); break;
case 2:
int x, y;
cout << "Введите длину / ширину прямоугольника" << endl;
cin >> x >> y;
cout << "\nP = " << 2 * x + 2 * y << "\nS = " << x * y << endl;
system("pause");
system("cls");
//
char x;
cin >> x;
system("cls");
cout << x << x << x << endl;
cout << x << x << x << endl;
cout << x << x << x << endl;
system("pause");
system("cls");
cout << "\t" << x << x << x << endl;
cout << "\t" << x << x << x << endl;
cout << "\t" << x << x << x << endl;
system("pause");
system("cls");
cout << endl << endl << endl << endl << x << x << x << endl;
cout << x << x << x << endl;
cout << x << x << x << endl;
system("pause");
system("cls");
//
char x[50];
float invoice, transportation, all_cost, y;
cout << "Введите ФИО покупателя - ";
cin >> x;
cout << "Введите сумму заказа - ";
cin >> y;
system("cls");
invoice = y * 0.06;
transportation = y * 0.1;
all_cost = y + invoice + transportation;
cout << "\t\t\tНАКЛАДНАЯ" << endl;
cout << "____________________________________________________________" << endl;
cout << "\tПОКУПАТЕЛЬ\t\t\t" << x << endl;
cout << "\tСумма заказа\t\t\t" << y << endl;
cout << "\tНалог\t\t\t\t" << invoice << endl;
cout << "\tТранспортировка\t\t\t" << transportation << endl;
cout << "____________________________________________________________" << endl;
cout << "\tСтоимость всего\t\t\t" << all_cost << endl;
cout << "____________________________________________________________" << endl;
system("pause");
break;
case 3:
float x, y, z, b; // определение переменных
cout << "Введите числа x/y/z" << endl;
cin >> x >> y >> z; // ввод данных
b = -x + (abs(pow(z, 2) - 20) + sqrt(abs(y))) / ((3 + pow(z, 5)) / 5); // формула, по которой расчитывается b
cout << "b = " << b << endl << "x = " << x << endl << "y = " << y << endl << "z = " << z << endl; // вывод всех значений
system("pause"); break;
case 4:
float x, y, z;
cout << "Введите действительные числа (Пример ввода: 4 6 3) --> ";
cin >> x >> y >> z; // вводим числа
system("cls");
if ((x != z) && (x != y) && (y != z)) // узнаём являются ли числа одинаковыми
{
cout << "Среди чисел " << x << ", " << y << ", " << z << " нет одинаковых" << endl;
if ((x > y) && (x > z)) /** выбераем большее число, и заменяем его значение на среднее арифметическое других чисел **/
{
cout << "Число x = " << x << " > y = " << y << " и " << " > z = " << z;
x = (y + z) / 2;
cout << ", поэтому ответ (y + z)/2 =" << x << endl;
}
else
if ((y > z) && (y > x))
{
cout << "Число y = " << y << " > x = " << x << " и " << " > z = " << z;
y = (x + z) / 2;
cout << ", поэтому ответ (x + z)/2 = " << y << endl;
}
else
if ((z > y) && (z > x))
{
cout << "Число z = " << z << " > y = " << y << " и " << " > x = " << x;
z = (x + y) / 2;
cout << ", поэтому ответ (x + y)/2 = " << z << endl;
}
}
else
cout << "Среди чисел есть одинаковые" << endl;
system("pause"); break;
case 5:
int tmp1 = 0, tmp2 = 0, i, number, sum_number, xtl;
number = 999999;// обозначение переменных
sum_number = 0;
while (number > 0) // начало цикла
{
xtl = number;
for (i = 0; i < 3; i++) // цикл, считающий сумму первых трёх переменных
{
tmp1 += number % 10; number /= 10;
}
for (i = 0; i < 3; i++) // цикл, считающий сумму последних цифр в переменной number
{
tmp2 += number % 10; number /= 10;
}
if (tmp1 == tmp2) // Сравнение сумм. Если суммы "=", то число счастливых билетов увеличивается
{
sum_number += 1;
// cout << sum_number << " - счастливых билетов" << endl // cчасливых билетов
}
tmp1 = 0; // обнуление переменных
tmp2 = 0;
number = xtl - 1; // уменьшение числа
}
cout << sum_number << " столько счастливых билетов" << endl; system("pause"); break;
case 6: p += 1; break;
default: cout << "неверный номер пункта меню" << endl; system("pause"); break;
}
}
}