Question: The polar coordinates r and 0 of a point (x, y) in the plane can be computed as follows: Vx² + y? r = acos(x/r) if r > 0 and y > 0 -acos(x/r) if r > 0 and y < 0 if r = 0 0 = Write a program called xy2polar.c which uses a function called polar () to compute the polar coordinates of a point. Your program must consist of a main program and a function called polar. The function polar() takes the x and y coordinates of a point as arguments and computes the polar coordinates coordinates (r, 0). Your program must consist of a main program, which opens the output file polarout.txt for appending (mode = "a"), reads the (x, y) coordinates, from the user, calls polar(), and then write both the (x, y) coordinates and the corresponding (r, 0) polar coordinates to the output file. For marking purposes run your program 4 times with (x, y) as follows: (2,2), (1,-1), (0,1) and (3,-1). The first (and subsequent) lines of your output should look like: The polar coordinates of (2.000, 2.000) are r = 2.828 and theta = 0.785 Copy and paste your program into the box below. #include #include /* function prototype */ int main(void) { /* you fill in here */ return 0; } /* function definition */

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

in C++

Question: The polar coordinates r and 0 of a point (x, y) in the plane can be computed as follows:
r = Vx2 + u?
{
acos(x/r)
-acos(x/r)
if r > 0 and y > 0
if r > 0 and y< 0
if r = 0
Write a program called xy2polar.c which uses a function called polar() to compute the polar
coordinates of a point. Your program must consist of a main program and a function called polar.
The function polar () takes the x and y coordinates of a point as arguments and computes the polar
coordinates coordinates (r, 0).
Your program must consist of a main program, which opens the output file polarout.txt for appending
(mode = "a"), reads the (x, y) coordinates, from the user, calls polar(), and then write both the
(x, y) coordinates and the corresponding (r, 0) polar coordinates to the output file.
For marking purposes run your program 4 times with (x, y) as follows: (2,2), (1,-1), (0,1) and
(3,-1).
The first (and subsequent) lines of your output should look like:
The polar coordinates of (2.000, 2.000) are r = 2.828 and theta =
0.785
Copy and paste your program into the box below.
#include <stdio.h>
#include <math.h>
/* function prototype */
int main(void)
{
/* you fill in here */
return O;
/* function definition */
Transcribed Image Text:Question: The polar coordinates r and 0 of a point (x, y) in the plane can be computed as follows: r = Vx2 + u? { acos(x/r) -acos(x/r) if r > 0 and y > 0 if r > 0 and y< 0 if r = 0 Write a program called xy2polar.c which uses a function called polar() to compute the polar coordinates of a point. Your program must consist of a main program and a function called polar. The function polar () takes the x and y coordinates of a point as arguments and computes the polar coordinates coordinates (r, 0). Your program must consist of a main program, which opens the output file polarout.txt for appending (mode = "a"), reads the (x, y) coordinates, from the user, calls polar(), and then write both the (x, y) coordinates and the corresponding (r, 0) polar coordinates to the output file. For marking purposes run your program 4 times with (x, y) as follows: (2,2), (1,-1), (0,1) and (3,-1). The first (and subsequent) lines of your output should look like: The polar coordinates of (2.000, 2.000) are r = 2.828 and theta = 0.785 Copy and paste your program into the box below. #include <stdio.h> #include <math.h> /* function prototype */ int main(void) { /* you fill in here */ return O; /* function definition */
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY