output is not showing up

i'm trying to create a function that convert from cartesian to polar but the output is only the answer for r and not for theta
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
#include <math.h>
using namespace std;

double cartesianTopolar( double y, double x, double theta);

int main()
{
	double x, y, r, theta;
	cout << " Enter a coordinate in cartesian system (x,y) :\n ";
	cin >> x >> y;

	r = cartesianTopolar(x, y,theta);
	cout << " The coordinates in polar system is :\n";
	cout << r << "\t" << theta << "\n";
	return 0;
}
double cartesianTopolar(double y, double x, double theta)
{
	double r = sqrt((pow(x, 2)) + (pow(y, 2)));
	 theta = atan(y / x);
	 theta = (theta * 180) / 3.141592654;
	
	return r;
}
Last edited on
PLEASE USE CODE TAGS (the <> formatting button) when posting code.
It makes it easier to read your code and also easier to respond to your
post.
http://www.cplusplus.com/articles/jEywvCM9/
Hint: You can edit your post, highlight your code and press the <>
formatting button.
Topic archived. No new replies allowed.