具体代码为
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
double a,g,l,b,p,d,n,U,tg,vg,r1,r2,q,pi;
a=981;g=9.8;l=0.002;b=8.23*(10^(-3));p=0.101*(10^6);d=0.005;n=1.83*(10^(-5));
pi=3.14;
cout<<"U:";
cin>>U;
cout<<"tg:";
cin>>tg;
vg=(l/tg)*10000;
r1=9*n*vg/2/a/g;
r2=sqrt(r1);
q=18*pi*d/U/sqrt(2*a*g)*(sqrt(n*l/tg/(1+b/p/r2)))*(sqrt(n*l/tg/(1+b/p/r2)))*(sqrt(n*l/tg/(1+b/p/r2)));
cout<<vg<<endl<<r2<<endl<<q<<endl;
return 0;
}
在c语言中^是表示异或的意思,故这里的b,p,n都是负数了,应该改为用pow函数:
#include <iostream>