![Paasbanti](https://sproshu.net/uploads/ava/1/ava3862.jpg)
Paasbanti
4 год назад
Составить программу,которая печатает true,если точка с координатами (x,y) принадлежит заштризованнойобласти,и false в противном случае.
![](https://store.sproshu.net/207e/c99da9c97.jpg)
ОТВЕТЫ
![Демьян](https://sproshu.net/uploads/ava/3/ava3879.jpg)
Демьян
Oct 24, 2020
#include <iostream>
using namespace std;
int main()
{
double x, y;
cout << "x = ", cin >> x;
cout << "y = ", cin >> y;
if ((x>=-2)&&(x<=2)&&(y>=0)&&(y<=4)||(x>=-4)&&(x<=5)&&(y>=-3)&&(y<0))
cout << "true";
else cout << "false";
return 0;
}
Пример:
x = 3
y = -1
true
using namespace std;
int main()
{
double x, y;
cout << "x = ", cin >> x;
cout << "y = ", cin >> y;
if ((x>=-2)&&(x<=2)&&(y>=0)&&(y<=4)||(x>=-4)&&(x<=5)&&(y>=-3)&&(y<0))
cout << "true";
else cout << "false";
return 0;
}
Пример:
x = 3
y = -1
true
800
Смежные вопросы: