Search:

Submit Article

# Program to convert points to rectangle coordinates and polar coordinates

Posted By: Easy Tutor     Category: C++ Programming     Views: 16144

## Code for Program to convert points to rectangle coordinates and polar coordinates in C++ Programming

```/*www.DailyFreeCode.comDownload Projects, Sourcecodes, Tips and Tricks, Interview FAQs, Hotlinks and more....Logon to www.DailyFreeCode.com*///Three steps for Polar cordinates//1)convert points to rectangular cordinates//2)Addition of Points//3)Converting Back to Polar cordinates

#include <iostream.h>
#include <math.h>
#include <conio.h>

class polar
{
double angle;

double getx()
{return radius*cos(angle);} //These two functiondouble gety()                 //convert this polar objects
{return radius*sin(angle);} //into x and y rectangular coordspublic:
polar()

polar(float r,float a)
{
angle=a;
}

void display()
{
}

polar operator + (polar o2)
{
double x=getx()+o2.getx();
double y=gety()+o2.gety();
double r=sqrt(x*x + y*y);   //converts x and y todouble a=atan(y/x);         //Polar co-ordinate.return polar(r,a);
}
};

void main()
{
clrscr();
polar o1(10,2),o2(10,5),o3;

o3=o1+o2;

cout<<"\no1 =";
o1.display();
cout<<"\no2 =";
o2.display();
cout<<"\no3 =";
o3.display();

getch();
}
```
Share:

 Easy Tutor author of Program to convert points to rectangle coordinates and polar coordinates is from United States. Easy Tutor says Hello Friends,I am Free Lance Tutor, who helped student in completing their homework. I have 4 Years of hands on experience on helping student in completing their homework. I also guide them in doing their final year projects.I have share many programs on this website for everyone to use freely, if you need further assistance, than please contact me on easytutor.2ya [at the rate] gmail [dot] comI have special discount scheme for providing tutor services. I am providing tutor service to students from various contries, currently most of my students are from United States, India, Australia, Pakistan, Germany, UK and Canada. I am also here to expand my technical network to receive more opportunity in my career, make friends to help them in resolving their technical problem, learn and share my knowledge, If you like to be my friend, Please send me friend request.Thanks,Happy Programming :) View All Articles

 Please enter your CommentComment should be atleast 30 Characters.Please put code inside [Code] your code [/Code]. No Comment Found, Be the First to post comment!