Question: We are supposed to write a C program in puTTY that converts polar cordinates to rectangular and vice versa for the 1st and 4th quadrants.

We are supposed to write a C program in puTTY that converts polar cordinates to rectangular and vice versa for the 1st and 4th quadrants.

This is my main:

int main(void)

{

int choice;

float r;

float theta;

float x;

float y;

description();

choice = get_choice();

if (choice == 1)

{

get_polar_data(&r, &theta);

convert_to_rect(r, theta, &x, &y);

print_pr_result(r, theta, x, y);

}

else

{

get_rect_data(&x, &y);

convert_to_polar(x, y, &r, &theta);

print_rp_result(x, y, r, theta);

}

return 0;

}

This is an example output:

This program will convert

polar coordinates to rectangular coordinates or

rectangular coordinates to polar coordinates

Enter 1 for polar to rectangular

Enter 2 for rectangular to polar

Your choice: 1

Enter the value for r (meters): 100

Enter the value for theta (degrees): 30

r = 100.00 and theta = 30.00

converts to

x = 86.60 and y = 50.00

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!