Check if a point is inside , outside or on a Hyperbola | C ++ program for the above approach ; Function to check if the point ( x , y ) lies inside , on or outside the given hyperbola ; Stores the value of the equation ; Generate output based on value of p ; Driver Code
#include <bits/stdc++.h> NEW_LINE using namespace std ; void checkpoint ( int h , int k , int x , int y , int a , int b ) { int p = ( pow ( ( x - h ) , 2 ) / pow ( a , 2 ) ) - ( pow ( ( y - k ) , 2 ) / pow ( b , 2 ) ) ; if ( p > 1 ) { cout << " Outside " ; } else if ( p == 1 ) { cout << " On ▁ the ▁ Hyperbola " ; } else { cout << " Inside " ; } } int main ( ) { int h = 0 , k = 0 , x = 2 ; int y = 1 , a = 4 , b = 5 ; checkpoint ( h , k , x , y , a , b ) ; return 0 ; }