#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int DenklemCoz(int,int,int,int,int);
float UzaklikBul(int,int,int,int,int);
void NoktaEkranaYaz(int[][2],int,int,int,int,int,int);
int main()
{
int a,b,c,x,y,n,i=0;
float f,h;
int dP[10][2];
cout<<"a degerini gir:";cin>>a;
cout<<"b degerini gir:";cin>>b;
cout<<"c degerini gir:";cin>>c;
cout<<"bulunacak nokta sayisini gir:";cin>>n;
do
{ cout<<"x degerini gir:";cin>>x;
cout<<"y degerini gir:";cin>>y;
f=DenklemCoz(a,b,x,y,c);
if(f==0)
{ dP[i][1]=x;
dP[i][2]=y;
i++; }
else{ h=UzaklikBul(a,b,x,y,c);
cout<<setprecision(4)<<"nokta dogrudan "<<h<<" birim mesafe uzakliktadir."<<endl;} }
while(i<n);
NoktaEkranaYaz(dP,a,b,x,y,c,n);
return 0;
}
int DenklemCoz(int a,int b,int x,int y,int c)
{ return a*x+b*y+c; }
float UzaklikBul(int a,int b,int x,int y,int c)
{return fabs(a*x+b*y+c)/sqrt(pow(a,2)+pow(b,2)); }
void NoktaEkranaYaz(int dP[][2], int a, int b, int x, int y, int c, int n)
{ cout<<endl<<a<<"x+"<<b<<"y+"<<c<<"=0 "<<"dogrusu uzerinde bulunan noktalar:"<<endl;
for(int i=0;i<n;i++)
cout<<"x="<<dP[i][1]<<" y="<<dP[i][2]<<" "<<endl; }