Write a program that takes a point (x,y) from theuser and find where does the point lies. The pointcan

lie on any of the following

?? 1st Quadrant

?? 2nd Quadrant

?? 3rd Quadrant

?? 4th Quadrant

Theprogram should terminate when the user press (n).

Respuesta :

Answer:

C++ Program .

#include<bits/stdc++.h>

using namespace std;

int main()

{

int x,y;//declaring two variables x and y.

string s;//declaring string s..

cout<<"enter x and y"<<endl;

cin>>x>>y;//taking input of x and y..

if(x>=0 &&y>=0) //condition for 1st quadrant..

cout<<"the point lies in 1st Quadrant"<<endl;

else if(x<=0 &&y>=0)//condition for 2nd quadrant..

cout<<"the point lies in 2nd Quadrant"<<endl;

else if(x>=0 &&y<=0)//condition for 3rd quadrant..

cout<<"the point lies in 3rd Quadrant"<<endl;

else //else it is in  4th quadrant..

cout<<"the point lies in 4th Quadrant"<<endl;

cout<<"enter n to terminate the program"<<endl;

while(cin>>s)//if the user has not entered n the program will not terminate..

{

   if(s=="n")

   {

       cout<<"the program is terminated"<<endl;

       exit(0);

   }

   cout<<"you have not entered n please enter n to terminate the program<<endl;

}

}

Explanation:

The above written program is for telling the point lies in which quadrant.I am first declaring two variables x and y.Then after that taking input of x and y after that checking in which quadrant the point lies.

Taking input of the string s declared earlier for program termination the program will keep running until the user enters n.

Answer:

Explanation:

bfdjh f jgfhydjyd gdtshts mtdmht