Answer the question
In order to leave comments, you need to log in
How to determine the total resistance of a connection?
Good day! Please help me, a beginner programmer, complete the program. Problem condition:
A) Three resistances R1, R2, R3 are connected in parallel. Determine the total resistance of the connection. B) Three resistances R1, R2, R3 are connected in series. Determine the total resistance of the connection.
Here are my work:
#include <stdio.h>
#include <conio.h>
#include <iostream>
using namespace std;
int main()
{
double Rsum,R1,R2,R3;
char Sl;
cout << "Для какого случая необходимо показать решение (А или Б)? ";
cin>>Sl;
if (Sl)=='А'
{
cout << "Введите R1, R2 и R3: ";
cin>>R1; cin>>R2; cin>>R3;
if (R1>0)||(R2>0)||(R3>0)
{
Rsum=1/(1/R1+1/R2+1/R3);
}
else
if (R1<0)||(R2<0)||(R3<0)
{
Rsum==0;
}
}
cout << "Сопротивление соединения равно: " << Rsum " Ом. ";
}
else
if (Sl)=='Б'
{
cout << "Введите R1, R2 и R3: ";
cin>>R1; cin>>R2; cin>>R3;
if (R1>0)||(R2>0)||(R3>0)
{
Rsum=R1+R2+R3;
}
else
if (R1<0)||(R2<0)||(R3<0)
{
Rsum==0;
}
cout << "Общее соединения равно: " << Rsum " Ом. ";
getch();
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question