<meta property="og:description" content="This is another simple C++ program done for KTSI. This one converts rectangular to polar coordinates. #include #include using namespace std; void rect2polar(double &value, double &angle, double x, double y) { value = sqrt(pow(x, 2) + pow(y, 2)); angle = 180 / M_PI * atan2(y,x); } int main(){ double value; double angle; double x = 4; double y = 3; rect2polar(value, angle, x, y); cout << 'x = ' << x << endl; cout << 'y = ' << y << endl; cout << 'value = ' << value << endl; cout << 'angle = ' << angle < <meta name="twitter:description" content="This is another simple C++ program done for KTSI. This one converts rectangular to polar coordinates. #include #include using namespace std; void rect2polar(double &value, double &angle, double x, double y) { value = sqrt(pow(x, 2) + pow(y, 2)); angle = 180 / M_PI * atan2(y,x); } int main(){ double value; double angle; double x = 4; double y = 3; rect2polar(value, angle, x, y); cout << 'x = ' << x << endl; cout << 'y = ' << y << endl; cout << 'value = ' << value << endl; cout << 'angle = ' << angle < Simple C++ rect2polar program @KTSI - Thomas Maurer

11:10 am School

# Simple C++ rect2polar program @KTSI

This is another simple C++ program done for KTSI. This one converts rectangular to polar coordinates.

```#include
#include

using namespace std;

void rect2polar(double &amp;value, double &amp;angle, double x, double y) {
value = sqrt(pow(x, 2) + pow(y, 2));
angle = 180 / M_PI * atan2(y,x);
}

int main(){
double value;
double angle;
double x = 4;
double y = 3;

rect2polar(value, angle, x, y);

cout &lt;&lt; "x = " &lt;&lt; x &lt;&lt; endl;
cout &lt;&lt; "y = " &lt;&lt; y &lt;&lt; endl;
cout &lt;&lt; "value = " &lt;&lt; value &lt;&lt; endl;
cout &lt;&lt; "angle = " &lt;&lt; angle &lt;&lt; endl;
//system("PAUSE");
return 0;
}```

Tags: , , , , , , , , , , , Last modified: July 5, 2019
Close Search Window