Advertisement
khaiwen1111

MW current_concentration

Feb 4th, 2020
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.80 KB | None | 0 0
  1.  
  2. #include <iostream>
  3. #include <cstdint>
  4. #include <iomanip>
  5. using namespace std;
  6.  
  7. int main()
  8. {
  9.     const double I_SAT = 7.55e-14;
  10.     const double KTQ = 0.02585;
  11.     double vol_max, vol_min, increament, vol_final,volt;
  12.     int limit;
  13.     cout << "Voltage (minimum): ";
  14.     cin >> vol_min;
  15.     cout << "Voltage (maximum): ";
  16.     cin >> vol_max;
  17.     cout << "Increament in voltage: ";
  18.     cin >> increament;
  19.     limit = (vol_max - vol_min) / increament;
  20.     cout << "Voltage" << setw(10) << "I<A>"<<endl;
  21.     for (int i = 0; i <= limit; i++)
  22.     {
  23.         volt = vol_min + i * increament;
  24.         vol_final = I_SAT * (exp(volt/ KTQ) - 1);
  25.         cout <<fixed<< setprecision(3) <<volt<<setw(15) <<scientific<< vol_final << endl;
  26.         if (vol_final > 1)
  27.         {
  28.             double output = volt;
  29.             cout << fixed <<"\nThe diode turn on voltage is " << output;
  30.         }
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement