//
// Get the polar representation of any complex numbers
// 2008-05-09: Tomonori Kouya
//
#include <iostream>
#include <complex>

using namespace std;

int main(int argc, char argv[])
{
	complex<double> c;

	// input complex number
	cout << "Input complex number like: (RealPart, ImaginaryParg)" << endl;
	cout << "->";
	cin >> c;

	// confirm c
	cout << "Your inputed number = " << c << endl;

	// print polar representation
	cout << "Polar Representation= " << abs(c) << " * ( cos(" << arg(c) << "), sin(" << arg(c) << ") )" << endl;

	// check
	cout << "Original number     = " << abs(c) * exp(complex<double>(0.0, 1.0) * arg(c)) << endl;

	return 0;
}
