Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // SS - 2/6/2012 - Project 1
- #include <iostream>
- #include <cstdlib>
- #include <cmath>
- #include <string>
- using namespace std;
- int main()
- {
- //Prompts user for input of time
- cout << "Sean Sapp" << endl;
- cout << "ECE 1305 PP01" << endl;
- cout << endl;
- cout << "Please enter the time in millo seconds." endl;
- constant double VDC = 10.0 //DC Voltage Source
- constant double R = 10,000.0 //Resistance in Ohms
- constant double C = 100.0 * 10e-12 //Capacitants in Farads
- double t;
- cin >> t;
- t= t*0.000001 //convert microseconds to seconds
- double i;
- i=(VDC/R)*exp(-t/R*C);
- double v;
- v=(VDC/R)*(1-(exp(-t/R*C)));
- cout << "The voltage at time" << t*1000000.0 << "micro seconds" << v << "Volts" >> endl;
- cout << "The current at time" << t*100000.0 << "micro seconds" << i*1000 << "milliamps" << endl;
- system ("pause");
- return (0);
- }
Add Comment
Please, Sign In to add comment