#include<iostream> #include<cmath> using namespace std; void polar_to_rect(double&, double&, double , double ); int main() { char ch; double mag, angle, x, y; cout<<" This program converts a polar vector to a rectangular vector.."<<endl<<endl; while (ch != 'n') { cout<<"Enter the value of mag: "; cin>>mag; cout<<"Enter the value of angle: "; cin>>angle; polar_to_rect(mag,angle, x, y); cout<<" >>x = "<<x<<endl; cout<<" >>y= "<<y<<endl<<endl; cout<<"Another calculation? (y/n)... "; cin>>ch; } return 0; } void polar_to_rec(double _mag, double angle, double &x, double &y) { x = _mag(cos(angle)); y = _mag(sin(angle)); return; }
_mag
C++
Quote: x = _mag(cos(angle)); y = _mag(sin(angle));
x = _mag * cos(angle); y = _mag * sin(angle);
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)