// Zig Herzog
// Oct. 5 , 2008
//
// Example for system-provided functions with single return value
// Here using the math-functions : atan , sin , cos  which
// need an argument and return a value of type double.
// Note : you need to include the library header <cmath>
 
#include <iostream>
#include <cmath>           // needed for all kinds of math-functions
using namespace std;

int main ( )
{
	double angle , length , xComponent , yComponent ;

	double PI ;
	PI = 4.*atan(1.0) ;	           // Calculate PI to convert deg to rad
	cout << "Give length [m] : " ;
	cin >> length ;
	cout << "Give angle [deg] : " ;
	cin >> angle ;
	angle = angle/180.*PI ;           // convert angle from deg to rad

	xComponent = length * cos ( angle ) ;
	yComponent = length * sin ( angle ) ;

	cout << "x,y-component : " << xComponent << " , " << yComponent << endl;

}


Zig Herzog; hgnherzog@yahoo.com