日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當(dāng)前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

MFC检查透镜质量程序

發(fā)布時(shí)間:2025/5/22 编程问答 24 豆豆
生活随笔 收集整理的這篇文章主要介紹了 MFC检查透镜质量程序 小編覺得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

題目:

某光學(xué)儀器廠生產(chǎn)一種系列透鏡,這種透鏡系列包括凸透鏡、凹透鏡及平面透鏡。該廠檢驗(yàn)科采用的檢驗(yàn)方法是:通過該透鏡的體積、密度,算出質(zhì)量,再用天平稱量透鏡的實(shí)際質(zhì)量,根據(jù)質(zhì)量差評(píng)估該透鏡是否合格。因此需要設(shè)計(jì)一個(gè)小軟件工具,來計(jì)算透鏡質(zhì)量。

可測(cè)量的數(shù)據(jù)包括:鏡柱的高H、鏡柱的半徑R、凸透球缺或凹透球缺的球半徑r以及透鏡的密度ρ,而球卻的底面半徑等于鏡柱的半徑。

void CCheckLensDlg::OnBUTTON1Count() {// TODO: Add your control notification handler code herechar c_BallRadius[255], c_CylinderRadius[255], c_CylinderHeight[255], c_LensDensity[255], c_Result[255];double BallRadius=0, CylinderRadius=0, CylinderHeight=0, LensDensity=0,Result=0;double BallRadius1=0, CylinderRadius1=0, CylinderHeight1=0, LensDensity1=0,Result1=0;m_BallRadius.GetWindowText(c_BallRadius,10)/10;m_CylinderRadius.GetWindowText(c_CylinderRadius,10)/10;m_CylinderHeight.GetWindowText(c_CylinderHeight,10)/10;m_LensDensity.GetWindowText(c_LensDensity,10);BallRadius = atof((LPCTSTR)c_BallRadius);CylinderRadius = atof((LPCTSTR)c_CylinderRadius);CylinderHeight = atof((LPCTSTR)c_CylinderHeight);LensDensity = atof((LPCTSTR)c_LensDensity);const double PI=3.14;//計(jì)算球冠的高度double BallHeight = 0;BallHeight = BallRadius - sqrt(BallRadius * BallRadius - CylinderRadius * CylinderRadius);//計(jì)算圓柱的質(zhì)量double CylinderMassTemp = 0;CylinderMassTemp = PI * CylinderRadius * CylinderRadius * CylinderHeight * LensDensity;//計(jì)算球冠的質(zhì)量double BallMassTemp = 0;BallMassTemp = PI / 3 * (3*BallRadius - BallHeight) * BallHeight * BallHeight * LensDensity;switch(m_Control){case 0:if(BallRadius !=0 ){if(MessageBox("數(shù)據(jù)不合法,球冠半徑r應(yīng)為0,請(qǐng)重新輸入!","消息提示",MB_ICONWARNING|MB_OK)==IDOK)OnBUTTON2Clean();}elseResult = CylinderMassTemp;break;case 1:if(BallRadius < CylinderRadius){if(MessageBox("球冠半徑r < R圓柱體半徑,請(qǐng)重新輸入!","消息提示",MB_ICONWARNING|MB_OK)==IDOK)OnBUTTON2Clean();}elseResult = CylinderMassTemp + BallMassTemp;break;case 2:if(BallRadius < CylinderRadius){if(MessageBox("球冠半徑r < R圓柱體半徑,請(qǐng)重新輸入!","消息提示",MB_ICONWARNING|MB_OK)==IDOK)OnBUTTON2Clean();}elseResult = CylinderMassTemp - BallMassTemp;break;case 3:if(BallRadius < CylinderRadius){if(MessageBox("球冠半徑r < R圓柱體半徑,請(qǐng)重新輸入!","消息提示",MB_ICONWARNING|MB_OK)==IDOK)OnBUTTON2Clean();}elseResult = CylinderMassTemp + 2*BallMassTemp;break;case 4:if(BallRadius < CylinderRadius){if(MessageBox("球冠半徑r < R圓柱體半徑,請(qǐng)重新輸入!","消息提示",MB_ICONWARNING|MB_OK)==IDOK)OnBUTTON2Clean();}elseResult = CylinderMassTemp - 2*BallMassTemp;break;case 5:if(BallRadius < CylinderRadius){if(MessageBox("球冠半徑r < R圓柱體半徑,請(qǐng)重新輸入!","消息提示",MB_ICONWARNING|MB_OK)==IDOK)OnBUTTON2Clean();}elseResult = CylinderMassTemp;break;}_gcvt(Result,20,c_Result);m_Result=(LPCTSTR)c_Result;UpdateData(FALSE);}



轉(zhuǎn)載于:https://blog.51cto.com/fjwind/1204414

總結(jié)

以上是生活随笔為你收集整理的MFC检查透镜质量程序的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。