Hello I wrote this simple program it accepts 2 user input parameters and returns another parameter that was calculated based on the user inputs. But I think my logic is wrong as it is not working.
Code:
int Forward_Complex_Transformation_Z(float Real, float Complex)
{
float Real, Complex, Z;
Z = sqrt((Real*Real) + (Complex*Complex));
return Z;
}
int Forward_Complex_Transformation_Theta(float Real, float Complex)
{
float Real, Complex, Theta;
Theta = (atan(Complex / Real))*(180/pi);
return Theta;
}
int main()
{
float baseVoltageReal,baseVoltageComplex, zVoltage,thetaVoltage;
printf("Enter the real part of the base voltage:\n");
scanf("%f",&baseVoltageReal);
printf("Enter the complex part of the base voltage:\n");
scanf("%f",&baseVoltageComplex);
Forward_Complex_Transformation_Z(baseVoltageReal,baseVoltageComplex);
Forward_Complex_Transformation_Theta(baseVoltageReal,baseVoltageComplex);
zVoltage = Forward_Complex_Transformation_Z();
thetaVoltage = Forward_Complex_Transformation_Theta();
return 0;
}
WHat I basically am tyring to do is send the function "Forward_Complex_Transformation_Theta" and Forward_Complex_Transformation_Z" two parameters from the main function and use the return values "Z" and "Theta".
Code:
zVoltage = Forward_Complex_Transformation_Z();
thetaVoltage = Forward_Complex_Transformation_Theta();
The reason why I wrote the above line is that I want to use their retuen value and assign them to another variable that i will use later in the program.
I can't seem to get this to work any help will be good.