0

Need help with this code I'm supposed to be getting (169.211) when i input 0.7

#include<iostream> #include<cmath> #define R 10 #define R 10 #define Vt 120 #define P 260 #define Pf 0.6 using namespace std; int main () { cout<<"Enter power factor :"; double pf; cin>>pf; double Vs; Vs = sqrt(pow(Vt + (2*R*P/Vt),2)) + pow((2*R*P)/(Pf*Vt),2) * (1-pow(Pf,2)); double vrms; cout<<"Required supply voltage = "<<Vs<<vrms<<endl; }

6th Jan 2018, 5:01 PM
Buruboyefe Emmauel
2 odpowiedzi
0
I put this into my calculator and got none of your values. I saw your not useing the pf variable only the #define Pf. Also why are you square rooting something squared just use abs() if you want it positive.
6th Jan 2018, 5:52 PM
Joseph
0
I think you have implemented the formula with incorrect variable. pf is your input variable and Pf is constant. check your formula and change as required.
6th Jan 2018, 9:36 PM
Rashed Latif
Rashed Latif - avatar