lab5_124

Run Settings
LanguageC++
Language Version
Run Command
#include <iostream> using namespace std; int main ( ) { int i, j ; int n ; int ** matr ; cout << "Input the number of points n =" ; cin >> n ; cout << "Input coordinates for the points \ n " ; matr = new int * [ n ] ; for ( i = 0 ; i < n ; ++ i ) { matr [ i ] = new int [ 2 ] ; for ( j = 0 ; j < 2 ; ++ j ) { if ( j == 0 ) { cout << "x" << i + 1 << "=" ; cin >> matr [ i ] [ j ] ; } if ( j == 1 ) { cout << "y" << i + 1 << "=" ; cin >> matr [ i ] [ j ] ; } } } int r ; cout << "Input the radius R =" ; cin >> r ; int count = 0 ; for ( i = 0 ; i < n ; ++ i ) { if ( ( pow ( matr [ i ] [ 0 ] , 2 ) + pow ( matr [ i ] [ 1 ] , 2 ) ) < pow ( r, 2 ) ) { ++ count ; } } if ( count ! = 0 ) { cout << "The number of point on the line : \ ' :" << count << " \ n " ; } else { cout << "There is point on the circle\ n " ; } for ( i = 0 ; i < n ; ++ i ) delete [ ] matr [ i ] ; delete [ ] matr ; return 0 ; }
Editor Settings
Theme
Key bindings
Full width
Lines