公式修正了,另外像dd说的,碳原子数和氢原子数也被我弄反了。。
贴上代码:
double N,M,Q,mol,speed,press;
UpdateData(TRUE);
mol=m_a*12+m_b+m_c*16+m_d*14.01;
if( m_c>=((2*m_a)+(m_b/2)))
{
N=(m_b+m_c*2+m_d*2)/(4*mol);
M=(4*mol)/(m_b+m_c*2+m_d*2);
Q=(1000*(28.9*m_b+94.05*m_a+0.239*m_Hf))/mol;
}
else if((m_c>=(m_b/2))&&(m_c<(2*m_a+m_b/2)))
{
N=(m_b+m_c*2+m_d*2)/(4*mol);
M=(56*m_d+88*m_c-m_b*8)/(m_b+m_c*2+m_d*2);
Q=(1000*(28.9*m_b+94.05*(m_c*0.5-0.25*m_b)+0.239*m_Hf))/mol;
}
else if(m_c<(m_b/2))
{
N=(m_b+m_d)/(2*mol);
M=(2*m_b+28*m_d+32*m_c)/(m_b+m_d);
Q=(1000*(57.8*m_c+0.239*m_Hf))/mol;
}
else
{
MessageBox(L"参数出错?");
return;
}
speed= 1.01* pow((N*pow(M,0.5)*pow(Q,0.5)),0.5)*(1+1.3*m_p) ; //D=1.01(NM0.5Q0.5)0.5(1+1.30ρ)
press=1.558*pow(m_p,2)*N*pow(M,0.5)*pow(Q,0.5); // P=1.558p2NM0.5Q0.5
m_XXXXXXXXrmat(L"%fGpa",press); m_XXXXXXXXXXXXrmat(L"%fkm/s",speed); UpdateData(FALSE);
贴上程序:
CaHbOcNd.rar
147.92KB
RAR
35次下载
建议LZ以后能给个测试用例,写完了我都不知道怎么验证对不对[s:233]