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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started