Write a complete C++ program to meet the following specifications. • Your progra
ID: 3696022 • Letter: W
Question
Write a complete C++ program to meet the following specifications.
• Your program should compute sum of any number of resistor the user enters. For example if the user enter number of resistors as 3 then the total resistance is Rt = R1 + R2 + R3
• If the user enters the voltage applied to these resistors then your program should compute current I = E/Rt
• If the user enters I (current in amps only) then your program should compute voltage
• Finally compute the power P using the formula P=E*I Hint: You may want to consider using for loop and if statements in case you need them
Explanation / Answer
//Power.cpp
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
int main()
{
double r1,r2,r3,rt;
cout<<" enter the values of r1,r2,r3;
cin>>r1>>r2>>r3;
rt=r1+r2+r3;
double P,E,I;
cout<<" enter voltage,E";
cin>>E;
I=E/rt;
P=E*I;
cout<<" the total power cosumed is "<<P;
getch();
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.