need help with this code

am trying to write code linking with ac circuit to read :
𝑍=𝑅=(𝑋𝑙+𝑋𝑐)𝑗
whereas
𝑋𝑙=2𝜋𝑓𝑙
𝑋𝑐=12𝜋𝑓𝑐
𝑤=2𝜋𝑓
[b]
i wrot this code but dosent work

#include <iostream>
#include <cmath>
using namespace std;
double V_Out_Funct(double X_l=2πfl, double X_c=□(1/2πfc), double w=2πf)
{
return Z=R*(X_l+X_c )j
}

int main()
{
double X_l=2πfl, X_c=□(1/2πfc), w=2πf;
//Variable Inputs
cout << "Enter the value of X_l=2πfl: ";
cin >> X_l=2πfl;
cout << "Enter the value of X_c=□(1/2πfc): ";
cin >> X_c=□(1/2πfc);
cout << "Enter the value of w=2πf: ";
cin >> w=2πf;
cout << "Enter the value of F: ";
cin >> F;
// calculate the Z
double Z=R*(X_l+X_c )j;
Z = Z_Funct(X_l=2πfl, X_c=□(1/2πfc), w=2πf);
cout << "Z:" << Z;

return 0;
}

..
You should probably use characters which will display on this forum. And use code tags when posting code.
It looks like things could be simplified. I would expect the user to input three values, Inductance L, Capacitance C and frequency F. (Unless I completely misunderstood what you are trying to do).

So you should do something like this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
    const double PI = 3.1415926535897932385;
    
    double L;
    double C;
    double F;

    cout << "Enter the value of L: ";
    cin >> L;

    cout << "Enter the value of C: ";
    cin >> C;

    cout << "Enter the value of F: ";
    cin >> F;

After getting the input values, carry out the required calculations and output the result.

Topic archived. No new replies allowed.