![]() This is the problem requirement: The user may enter up to 50 pairs, and the user will say he/she is done by inputting the coordinate pair (0, 0). Now we've taken this apart, we can see a few problems. ![]() Conversely, any value or expression which is not zero means logical true. But what about the other two? Well in both C and C++ any value which evaluates as zero is considered as meaning logical false. Since the & (logical AND) operator is used, that means the loop will continue to execute only when all three of these are true.īy now you are probably puzzled. Since count is set to 50, how does that check whether the user entered (0,0)? Thank you for taking the time to explain everything, I really appreciate it. Void polar( double x, doube y, double& r, double& theta) Void getrec( double x, double y) //To get rectangular coordinates void polar( double x, double y, double& r, double& theta) //To calculate polar coordinates void showPolarCoord( double radius, double angle) //To display polar coordinates const int SIZE = 50 Void showPolarCoord( double radius, double angle)Ĭout << "The polar coordinates are: " << endl Ĭout << " Distance from origin: " << radius << endl Ĭout << " Angle (in degrees) from x-axis: " << angle << endl Void polar( double x, double y, double& r, double& theta) Void getrec( double& x, double& y) //To get rectangular coordinates void polar( double x, double y, double& r, double& theta) //To calculate polar coordinates void showPolarCoord( double radius, double angle) //To display polar coordinates int main() I tried setting some sort of count, but i dont think I did it correctly I'm not sure how to make it so the user can enter 50 inputs. Prints lines showing both the input coordinates and output coordinates as ordered pairs in the style of this example: (4, 1) -> (11.3137, 45) Converts all shifted coordinate pairs to polar coordinates by calling the method you wrote. Shifts all coordinates to the right by 4 units and up by 7 units. Store the pairs in a pair of parallel arrays as you read them in. The user may enter up to 50 pairs, and the user will say he/she is done by inputting the coordinate pair (0, 0). prompts a user to input several pairs of positive Cartesian coordinates, one pair per line and separated by spaces. 1) Write a method that takes as input parameters a pair of Cartesian coordinates and which sets as output parameters a pair of polar coordinates corresponding to the same point as the input Cartesian coordinates.
0 Comments
Leave a Reply. |