Answer to Question #233123 in C++ for alex

Question #233123

Implement a C++ function “reactance()” which evaluates the reactance of a series circuit

consisting of an inductor L and capacitor C at frequency f:


reactance = 2π fL - 1/2π fC


Implement a main function which reads the values of L, C and f, calls the above function

and prints the reactance, e.g. if L =0.2 henries, C =2 μ farads and f = 50 Hz the reactance

will be –1528.717 Ω.


1
Expert's answer
2021-09-06T01:59:31-0400
#include <bits/stdc++.h>


using namespace std;


double reactance(double L, double C, double f)
{
    double r = 2 * M_PI * f * L - 1 / 2 * M_PI * f * C;
    return r;
}


double L, C, f;


int main()
{
    cin >> L >> C >> f;
    cout << "Reactance: " << reactance(L, C, f) << '\n';


    return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS