fork download
  1. #include <iostream>
  2. #include <cmath>
  3. using namespace std;
  4. int main()
  5. {
  6. float q, t, r, u, x, x1, x2,n1,e1;
  7. float p1 = 981,g = 9.80,l = 2.00e-3,b = 8.23e-3,p = 0.101e6,d = 5.00e-3,n = 1.83e-5;
  8. cout<<"先输入时间,再输入电压:"<<endl;
  9. cin >> t>>u;
  10. r = sqrt(9 * n*l / (2 * p1*g*t));
  11. x1 = ((n*l) / (t*(1 + b / (p*r))));
  12. x2 = x1*x1*x1;
  13. x = sqrt(x2);
  14. q = 18 * 3.14*x*d / (sqrt(2 * p1*g)*u);
  15. n1=q/(1.6e-19);
  16. if(n1-int(n1)>=0.5)
  17. {
  18. n1=int(n1)+1;
  19. }
  20. else if(n1-int(n1)<0.5||n1-int(n1)>=0)
  21. {
  22. n1=int(n1);
  23. }
  24. else
  25. {
  26. cout<<"error";
  27. }
  28. e1=q/n1;
  29. cout << "半径r= "<<r <<endl;
  30. cout<<"电量q= "<< q<<endl;
  31. cout<<"油滴所带基本电荷n= "<<n1<<endl;
  32. cout<<"实验数据所得电荷量e= "<<e1;
  33. return 0;
  34. }
Success #stdin #stdout 0.01s 5464KB
stdin
 22.84 240
stdout
先输入时间,再输入电压:
半径r=   8.66066e-07
电量q=   4.75991e-19
油滴所带基本电荷n=   3
实验数据所得电荷量e=   1.58664e-19