Question
I am lost and think I may be close, help please. Calculating Polar Coordinates The object ive of this P rogram is to illustrate and
I am lost and think I may be close, help please. Calculating Polar Coordinates The object ive of this P rogram is to illustrate and understand the use of files for input and output, to use the cmath library, and to format numerical output. You are to write a C++ program that will perform a conversion from Cartesian Coordinates (x, y) to Polar Coordinates (r, ). You should be familiar with graphing points in both Cartesian and Polar Coordinates. If you are not, you may want to review these concepts. Given Cartesian Coordinates (x, y) , use the following formulas to convert to Polar C oordinates : = 2 + 2 = tan 1 ( ) The cmath function for tan 1 (also known as arctangent ) is atan . The syntax to call the arctangent function is result = atan ( parameter); So you might use a statement like: theta = atan( ycoord / xcoord ); The function returns a v alue in radians, so the value theta will be in radian measure. Please read and follow the directions carefully. You will use two different files: o ne for data input, and one for data output. Your input data file will contain two real values that represent the x and y coord inates of a point in Cartesian C oordin ates. Write a computer program that: opens the input file, reads in the first line of th e file, which contains the file format information, reads in two floating point numbers , one for x and one for y , calculates the and values, ( will be in radians) calculates the equivalent value in degrees, and writes identical information to both the screen and to a file, consisting of: your usual identifying info, the input and output filenames, the input file format information, the numbers read in, the value for r , the value for in both radians and degrees.
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