#include
int main()
{
int n, op;
std::cout << "Enter the number of conductors" << std::endl;</p>
std::cin >> n;
std::cout << "Enter operation (1 for serial or 2 for parallel)" << std::endl;</p>
std::cin >> op;
double R = 0.0;
switch (op)
{
case 1:
{
for (int i = 0; i < n; ++i)
{
std::cout << "Enter the resistance of a " << i + 1 << " conductor" << std::endl;</p>
double temp;
std::cin >> temp;
R += temp;
}
break;
}
case 2:
{
for (int i = 0; i < n; ++i)
{
std::cout << "Enter the resistance of a " << i + 1 << " conductor" << std::endl;</p>
double temp;
std::cin >> temp;
R += 1 / temp;
}
R = 1 / R;
break;
}
default:
std::cout << "Unknown operation!" << std::endl;</p>
break;
}
std::cout << "R == " << R << std::endl;</p>
system("pause");
return 0;
}