Question: This is for C programming Write a program that gives user a choice to enter a point either in 2D space Cartesian coordinate (x and
This is for C programming
Write a program that gives user a choice to enter a point either in 2D space Cartesian coordinate (x and y coordinates) or Polar coordinates (r, theta), theta in degrees. Write a function toPolar() that takes Cartesian coordinates as input and converts that to Polar coordinates and displays the radial coordinate and angular coordinate in degrees. Then write another function toCartesian() that takes Polar coordinates (r, theta), theta in degrees, as input and converts that to Cartesian coordinates and displays that. When a user chooses to enter Cartesian coordinate, (s)he should get the output as Polar coordinate and vice-versa. You can look up the Polar Coordinate systems here - Use the math library functions for this program. You can use atan2(y, x) for Arc tangent calculation. So, you will have to convert radians to degrees and vice-versa as required. Enter P for Polar coordinate or C for Cartesian Coordinate: C Enter Cartesian coordinate (x, y) with space: -10 10 The Polar Coordinate for (x = -10.000000, y = 10.000000) is r=14.142136, theta=135.000000 degrees
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
