#include <iostream>
#include <iomanip>
#include <cmath>
using namespace std;
float calculatewd(float,float,float);
float calculatedw(float,float,float);
int main(){
float x,y,z,a,b,c;
char input;
do{
cout<<"input W for conversion of WYE to Delta or D for conversion of Delta to WYE"<<endl;
cin>>input;
}
while((input!='W') && (input!='D'));
if (input=='w'|| input=='W'){
cout<<"input value for Resistor 1, Resistor 2, Resistor 3"<<endl;
std::cin >> x;
std::cin >> y;
std::cin >> z;
calculatewd(x,y,z);
return (x,y,z);
}else if(input=='d'|| input=='D'){
cout<<"input value for Resistor A, Resistor B, Resistor C"<<endl;
std::cin >> a;
std::cin >> b;
std::cin >> c;
calculatedw(a,b,c);
return (a,b,c);
}
return 1;
}
float calculateawd(float r1, float r2, float r3){
float ra,rb,rc;
ra=((r1*r2)+(r2*r3)+(r3*r1))/(r1);
rb=((r1*r2)+(r2*r3)+(r3*r1))/(r2);
rc=((r1*r2)+(r2*r3)+(r3*r1))/(r3);
cout<<"value Resistor A is "<<ra<<endl;
cout<<"value Resistor B is "<<rb<<endl;
cout<<"value Resistor C is "<<rc<<endl;
return (ra,rb,rc);
}
float calculatedw(float ra, float rb, float rc){
float r1,r2,r3;
r1=(rb*rc)/(ra+rb+rc);
r2=(ra*rc)/(ra+rb+rc);
r3=(ra*rb)/(ra+rb+rc);
cout<<"value Resistor 1 is "<<r1<<endl;
cout<<"value Resistor 2 is "<<r2<<endl;
cout<<"value Resistor 3 is "<<r3<<endl;
return (r1,r2,r3);
}