"Polar Coordinates Addition" Code Answer's

You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "Polar Coordinates Addition" answered properly. Developers are finding an appropriate answer about Polar Coordinates Addition related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like Polar Coordinates Addition. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on Polar Coordinates Addition. 

Polar Coordinates Addition

By Thoughtful ToucanThoughtful Toucan on May 25, 2021
#include <iostream.h>
#include <math.h>
#include <conio.h>

class polar
{
  double radius;
  double angle;

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

 public:
   polar()
   {radius=0.0;angle=0.0;}

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

   void display()
    {
      cout<<\"(\"<<radius<<\", \"<<angle<<\")\";
    }

  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 to
    double 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();
}

Source: www.codepoc.io

Add Comment

0

All those coders who are working on the Whatever based application and are stuck on Polar Coordinates Addition can get a collection of related answers to their query. Programmers need to enter their query on Polar Coordinates Addition related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about Polar Coordinates Addition for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of Polar Coordinates Addition while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "Polar Coordinates Addition". Visit this developer's friendly online web community, CodeProZone, and get your queries like Polar Coordinates Addition resolved professionally and stay updated to the latest Whatever updates. 

Whatever answers related to "Polar Coordinates Addition"

View All Whatever queries

Whatever queries related to "Polar Coordinates Addition"

Browse Other Code Languages

CodeProZone