- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Лабораторная работа № 7
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
- •Void main()
Void main()
{
setlocale(LC_CTYPE, "Russian");
using namespace std;
double a, b, p, q, r, s;
cout << "Введите стороны участка"<<endl;
cin >> a >>b;
cout << "Введите длинну и ширину 1-го дома"<<endl;
cin >> p >> q;
cout << "Введите длинну и ширину 2-го дома" << endl;
cin >> r >> s;
if ((q + s <= a || q + s <= b) && (p + r <= a || p + r <= b) || (q + r <= a || q + r <= b) && (p + s <= a || p + s <= b))
{
cout << "Можно" << endl;
}
else
{
cout << "Нельзя" << endl;
}
}
N3
Пройдет ли шар радиуса r через ромбообразное отверстие с диагоналями p и q?
#include <iostream>
Void main()
{
double r, p, q, a,r2;
using namespace std;
setlocale(LC_CTYPE, "Russian");
cout << "Введите радиус круга" << endl;
cin >> r;
cout << "Введите диагонали ромба" << endl;
cin >> p >> q;
r2 = p*q / 2 * sqrt(pow(p, 2) + pow(q, 2));
if (r < r2)
{
cout << "Не пройдет" << endl;
}
else
{
cout << "Пройдет" << endl;
}
}
N4
Можно ли коробку размером a ∙ b ∙ c упаковать в посылку размером r ∙ s ∙ t? «Углом» укладывать нельзя.
#include <iostream>
Void main()
{
using namespace std;
setlocale(LC_CTYPE, "Russian");
double a, b, c, r, s, t;
cout << "Введите измерения коробки" << endl;
cin >> a >> b >> c;
cout << "Введите измерения посылки" << endl;
cin >> r >> s >> t;
if (a > r || a > s || a > t || b > r || b > s || b > t || c > r || c > s || c > t)
{
cout << "Не влезет" << endl;
}
else
{
cout << "Влезет" << endl;
}
}
Лабораторная работа №5
№1
Цикл через for
#include <iostream>
Void main()
{
using namespace std;
int b = 2, j = 6, n;
int i[4] = { 7,4,2,6 };
double a = 1.5*exp(8), y, t;
for (n=0; n<4; n++)
{
y = a / (b + exp(b)) / (1 + j*i[n]);
t = cos(y + 1) / sqrt(abs(-2 * j));
cout << "y = " << y << " t = " << t << endl;
}
}
№2
Цикл через while
i = 3(0,1)2
#include <iostream>
Void main()
{
using namespace std;
double y, t, b = 2, j = 6, a = 1.5e8, i = 3;
while (i > 2.01)
{
y = a / (b + exp(b)) / (j*i + 1);
t = cos(y + 1) / sqrt(abs(-2 * j));
i -= 0.1;
cout << "y= " << y << "\t t= " << t << endl;
}
}
№3
Через два цикла
b = 2,4(0,2)3,
a = {0,1; 1; 3}
#include <iostream>
Void main()
{
using namespace std;
int j = 6, i = 3, n;
double a[3] = { 0.1,-1, 3 }, b = 2.4, y, t;
for (n = 0; n < 3; n++);
{ do
{
y = (a[n]) / (b + exp(b)) / (1 + (j*i));
t = cos(y + 1) / sqrt(abs(-2 * j));
cout << "y = " << y << " t = " << t << endl;
b = b + 0.2;
} while (b < 2.9);
}
}
Начало
For
While
Начало
i
= 3,
b = 2, j= 6
b
= 2, j = 6
i
> 2.1
n
= 0, 3 Нет
Да
Вычисляем
y
и
t
CV Вычисляем
y
и
t
i
-= 0.1
Вывод
y
и
t
Вывод
y
и
t Два цикла
Начало
Конец Конец
b=2.4,
j = , i = 3 Вычисляем
y
и
t b
< 2.9 Вывод
y
и
t
n
= 0, 2
Нет
Да
b
+= 0.2
Конец
Доп. Задания
№1
Торговая фирма в первый день работы реализовала товаров на P тыс. руб., а затем ежедневно увеличивала выручку на 3%. Какой будет выручка фирмы в тот день, когда она впервые превысит заданное значение Q? Сколько дней придется торговать фирме для достижения этого результата?
#include <iostream>