Advertisement
kxcoze

lab22_4_1

Sep 6th, 2020
192
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.62 KB | None | 0 0
  1. #include <iostream>
  2. #include <math.h>
  3.  
  4. using namespace std;
  5.  
  6. int main() {
  7.     setlocale(LC_ALL, "rus");
  8.    
  9.     int n, k = 0;
  10.     double x, y, r;
  11.     cout << "Введите кол-во точек: ";
  12.     cin >> n;
  13.    
  14.     cout << "Введите радиус окружности: ";
  15.     cin >> r;
  16.  
  17.     for (int i = 0; i < n; i++) {
  18.         cout << "Введите координаты точки - (x, y): ";
  19.         cin >> x >> y;
  20.        
  21.         if (x >= 0 && x * x + y * y <= r * r)
  22.             k++;
  23.     }
  24.     cout << "Точек принадлежит фигуре - " << k << endl;
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement