Guest User

Untitled

a guest
Jun 18th, 2018
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. // SS - 2/6/2012 - Project 1
  2.  
  3.  
  4. #include <iostream>
  5. #include <cstdlib>
  6. #include <cmath>
  7. #include <string>
  8. using namespace std;
  9.  
  10. int main()
  11. {
  12. //Prompts user for input of time
  13. cout << "Sean Sapp" << endl;
  14. cout << "ECE 1305 PP01" << endl;
  15. cout << endl;
  16. cout << "Please enter the time in millo seconds." endl;
  17.  
  18. constant double VDC = 10.0 //DC Voltage Source
  19. constant double R = 10,000.0 //Resistance in Ohms
  20. constant double C = 100.0 * 10e-12 //Capacitants in Farads
  21.  
  22. double t;
  23. cin >> t;
  24. t= t*0.000001 //convert microseconds to seconds
  25.  
  26. double i;
  27. i=(VDC/R)*exp(-t/R*C);
  28.  
  29. double v;
  30. v=(VDC/R)*(1-(exp(-t/R*C)));
  31.  
  32. cout << "The voltage at time" << t*1000000.0 << "micro seconds" << v << "Volts" >> endl;
  33.  
  34. cout << "The current at time" << t*100000.0 << "micro seconds" << i*1000 << "milliamps" << endl;
  35.  
  36. system ("pause");
  37. return (0);
  38.  
  39. }
Add Comment
Please, Sign In to add comment