Лабораторная работа №2
Задача 3
ТЕКСТ:
#include "stdafx.h"
#include <iostream>
#include <math.h>
#include <stdio.h>
using namespace std;
void main()
{
setlocale(LC_ALL, "Russian");
double x, y, xN, xK, hx, yN, yK, hy, W, A, B, C, P, D, Wmin, xmin, ymin;
cout << "Введите xN, xK, hx, yN, yK, hy \n";
cin >> xN >> xK >> hx >> yN >> yK >> hy;
cout << "Исходные данные \n";
cout << "xN=" << xN << "\t xK=" << xK << "\t hx=" << hx << "\t yN=" << yN << "\t yK=" << yK << "\t hy=" << hy << endl;
cout << "Таблица \n";
cout << "\t x \t y \t W \n";
P = 1;
Wmin = pow(10., 10);
for (x = xN; x <= xK; x = x + hx)
for (y = yN; y <= yK; y = y + hy)
{
A = 3 * atan(x*y);
B = sqrt(pow(y, 2) + pow(x, 2));
C = acos(y - 0.3*x);
if (A > B) D = A;
else D = B;
if (D > C) W = D;
else W = C;
printf("%12.2f \t %4.2f \t %4.2f \n", x, y, W);
if (W <= 0.8) P = P*W;
if (W < Wmin) { Wmin = W; xmin = x; ymin = y; }
}
cout << "Wmin=" << Wmin << "\t xmin=" << xmin << "\t ymin=" << ymin << "\t P=" << P << endl;
}
РЕЗУЛЬТАТ: