Hi !
I'm trying to build a program that can convert polar to polar to cartesian using struct variables1 but here i came across a problem witch is when i scanf the values of (a&b) it telles me that i have to enter yet a another one !!
the code is !
I'm trying to build a program that can convert polar to polar to cartesian using struct variables1 but here i came across a problem witch is when i scanf the values of (a&b) it telles me that i have to enter yet a another one !!
the code is !
Code:
#pragma warning(disable:4996)
#include<stdio.h>
#include<stdlib.h>
#include<math.h>
void PolarTo_Cartesian(double r, double d, double *q, double *u);
struct MyStruct
{
double x;
double y;
};
int main(){
printf("enter ur cord\n");
struct MyStruct a;
struct MyStruct b;
a.x; // puting value to x
b.y;
scanf("%lf\n", &(a.x));
scanf("%lf\n", &(b.y));
PolarTo_Cartesian(a.x, b.y, &(a.x), &(b.y)); // to store the address so i can change its value !!
printf("the valus is (%lf,%lf)\n",a.x,b.y);
system ("pause");
return 0;
}
void PolarTo_Cartesian(double r, double d, double *q, double *u) {
*u = r*(sin(d));
*q = r*(cos(d));
}
Comment