北理工物理实验,三个油滴,每个油滴测五次,输出是科学计数法
比较粗糙,不过能用
#include <stdio.h>#include <math.h>#define rou 981 #define g 9.801 #define niu 1.83e-5 #define L 1.5e-3 #define d 5e-3 #define p 1.013e5 #define b 8.22e-3 #define pai 3.1415926 #define e0 1.602e-19int main() {double a[6], k, q, te[6], tg[6], ve[6], vg[6], u; double sumvg=0;printf("Input U:\n");scanf("%lf", &u);for (int i=0 ;i<5 ;i++){printf("Input tg,te\n"); scanf("%lf %lf", &tg[i],&te[i]); vg[i] = L / tg[i]; ve[i] = L / te[i]; sumvg+=vg[i];printf("vg=%e ve=%e \n", vg[i],ve[i]); } printf("average_vg=%e\n",sumvg/5);double tem;double sumq=0, sumn=0, sume=0,sumue=0,e[5];int n[5]; for (int i=0 ;i<5 ;i++){tem = 0;tem = (9 * niu*vg[i]) / (2 * rou*g); a[i] = sqrt(tem);k = (18 * pai / sqrt(2 * rou*g)) * pow( sqrt(niu*L / (1 + b / (p*a[i]))), 3) * d; q = (k * (1 / tg[i] + 1 / te[i]) * sqrt(1 / tg[i])) / u; n[i]=q/e0;e[i]=q/n[i];sumn+=n[i];sumq+=q;sume+=e[i];sumue+=(e[i]-e0)/e0;printf("a=%e k=%e q=%e n=%d e=%e %e\n",a[i],k,q,n[i],e[i],(e[i]-e0)/e0);}printf("average_q=%e\naverage_n=%e\naverage_e=%e\naverage_ue=%e\n",sumq/5,sumn/5,sume/5,sumue/5);return 0; }