#include <iostream>
using namespace std;
void circuitoTipoA( float Vs, float R1, float R2, float R3 );
void circuitoTipoB( float Vs, float R1, float R2, float R3 );
int main(){
float Vs, R1, R2, R3;
cout << "\nDatos del circuito:\n";
cout << "Vs: "; cin >> Vs;
cout << "R1: "; cin >> R1;
cout << "R2: "; cin >> R2;
cout << "R3: "; cin >> R3;
circuitoTipoA( Vs, R1, R2, R3 );
circuitoTipoA( Vs, R1, R2, R3 );
return 0;
}
void circuitoTipoA( float Vs, float R1, float R2, float R3 ){
float Rp = (R2 * R3) / (R2 + R3);
float Req = R1 + Rp;
float lt = Vs / Req;
float V1 = lt * R1;
float V2 = lt * Rp;
float l2 = V2 / R2;
float l3 = lt - l2;
cout << "\nCircuito tipo A: ";
cout << "\nRp: " << Rp << " KW."
<< "\nReq: " << Req << " KW."
<< "\nlt: " << lt << " mA."
<< "\nV1: " << V1 << " v."
<< "\nV2: " << V2 << " v."
<< "\nl2: " << l2 << " mA."
<< "\nl3: " << l3 << " mA."
<< endl;
}
void circuitoTipoB( float Vs, float R1, float R2, float R3 ){
float Rs = R2 + R3;
float Req = (R1 * Rs) / (R1 + Rs);
float l1 = Vs / R1;
float l2 = Vs / Rs;
float lt = l1 + l2;
float V2 = l2 * R2;
float V3 = Vs - V2;
cout << "\nCircuito tipo B: ";
cout << "\nRs: " << Rs << " KW."
<< "\nReq: " << Req << " KW."
<< "\nl1: " << l1 << " mA."
<< "\nl2: " << l2 << " mA."
<< "\nlt: " << lt << " mA."
<< "\nV2: " << V2 << " v."
<< "\nV3: " << V3 << " v."
<< endl;
}