for the part one I wrote include include include using names
for the part one I wrote
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(void)
{
float a, b, x, y, m, ang, pi;
char c;
cout << \"Enter The coordinates Followed By R/r or P/p :\" <<endl;
cin >> a >> b >> c; //reading the coordinates and character following them
if (c == \'r\' || c == \'R\') //check whether to see the character indicate rectangular coordinates
{
x = a;
y = b;
pi = 3.14159;
//calculate polar coordinates
m = sqrt((x*x) + (y*y));
ang = atan(y / x) * 180 / pi;
if (x < 0 ) //for the adjustment when x is less than 0
{
ang = 180 + ang;
}
//print the cooordinates
cout << \"Rectangular (\" << x << \",\" << y << \")\" << endl;
cout << \"polar coordinates (\" << m << \" & \" << ang << \")\" <<endl;
}
else if (c == \'p\' || c == \'P\') //check if the character represent polar coordinates
{
pi = 3.14159;
m = a;
ang = b ;
//calculate the rectangular coordinates
x = m*cos(ang * pi / 180);
y = m*sin(ang * pi / 180);
//print the coordinates
cout << \"Rectangular (\" << x << \",\" << y << \")\" <<endl;
cout << \"polar coordinates (\" << m << \" @ \" << ang << \")\" <<endl;
}
else //if the input format mismatch print the message to user
cout << \"Illegal input format\";
system(\"pause\");
return (0);
}
And I need help with part two. Thank you.
Could you program this without using float or string?
Thank you.
Program Requirements: Part 1: Polar Rectangular Conversation A location (point) in the two-dimensional Cartesian Coordinate System can be represented in two ways, by its Polar Coordinates or its Rectangular Coordinates. In the Polar Coordinate representation, the location is in the form M 0, where M is the distance from the origin to the point, and e is the angle measured from the X-axis to the point. In the Rectangular Coordinate representation, the location is in the form C. Y) where X and Y are the horizontal and vertical distances from their respective axes (X, Y) M To convert a location from the Polar Coordinates to the Rectangular Coordinates M cos (0) Y M sin (0) To convert a location from the Rectangular Coordinates to the Polar Coordinates. X2 Y 0 tanSolution
#include <iostream>
#include <cmath>
#include <iomanip>
using namespace std;
int main(void)
{
float a, b, x, y, m, ang, pi;
char c;
cout << \"Enter The coordinates Followed By R/r or P/p :\" <<endl;
cin >> a >> b >> c; //reading the coordinates and character following them
if (c == \'r\' || c == \'R\') //check whether to see the character indicate rectangular coordinates
{
x = a;
y = b;
pi = 3.14159;
//calculate polar coordinates
m = sqrt((x*x) + (y*y));
ang = atan(y / x) * 180 / pi;
if (x < 0 ) //for the adjustment when x is less than 0
{
ang = 180 + ang;
}
//print the cooordinates
cout << \"Rectangular (\" << x << \",\" << y << \")\" << endl;
cout << \"polar coordinates (\" << m << \" & \" << ang << \")\" <<endl;
}
else if (c == \'p\' || c == \'P\') //check if the character represent polar coordinates
{
pi = 3.14159;
m = a;
ang = b ;
//calculate the rectangular coordinates
x = m*cos(ang * pi / 180);
y = m*sin(ang * pi / 180);
//print the coordinates
cout << \"Rectangular (\" << x << \",\" << y << \")\" <<endl;
cout << \"polar coordinates (\" << m << \" @ \" << ang << \")\" <<endl;
}
else //if the input format mismatch print the message to user
cout << \"Illegal input format\";
system(\"pause\");
return (0);
}


