Advertisement
Guest User

Untitled

a guest
Sep 20th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.60 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3.  
  4. double cons(double R1, double R2) {
  5. return(R1 + R2);
  6. }
  7.  
  8. double par(double R1, double R2) {
  9. return ((R1*R2) / (R1 + R2));
  10. }
  11.  
  12.  
  13. void main(void) {
  14. cout << "Type down 4 circuit elememts \n";
  15. double R1, R2, R3, R4;
  16. cin >> R1 >> R2 >> R3 >> R4;
  17.  
  18. cout << "Resistance on 1st ciruit = ";
  19. cout << cons( cons (cons(R1, R2),R3),R4) << endl;
  20. cout << "Resistance on 2nd ciruit = ";
  21. cout << cons(par(R2, R4), R1) << endl;
  22. cout << "Resistance on 3d ciruit = ";
  23. cout << cons(cons(R3, par(cons(R2, par(R1,R3)), cons(R1,R4))),R4) << endl;
  24.  
  25. _getwch();
  26.  
  27. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement