VC++ 已知弦高,弦长,求半径,夹角, 弧度

编写过程简单:附代码

void CMyDlg::OnButton1() 
{
    // TODO: Add your control notification handler code here
    double H, L, r, A, C;

    CString str;
    ((CEdit *)(GetDlgItem(IDC_EDIT1)))->GetWindowText(str);  //拱高
     H = atof(str);
    ((CEdit *)(GetDlgItem(IDC_EDIT2)))->GetWindowText(str);  //弦长
     L = atof(str);
     
     if(H<=0 || L<=0)
     {
         AfxMessageBox("拱高,或弦长数值输入错误!!");
         return;
     }  

     ((CStatic *)(GetDlgItem(IDC_STATIC1)))->SetWindowText("0.0");  //0.0
     ((CStatic *)(GetDlgItem(IDC_STATIC2)))->SetWindowText("0.0");  //0.0
     ((CStatic *)(GetDlgItem(IDC_STATIC3)))->SetWindowText("0.0");  //0.0
     ((CStatic *)(GetDlgItem(IDC_STATIC4)))->SetWindowText("0.0");  //0.0

     r = H/2 + L*L/(8*H);
     str.Format("%0.3f", r);
     ((CStatic *)(GetDlgItem(IDC_STATIC1)))->SetWindowText(str);
     str.Format("%0.3f", r*2);
     ((CStatic *)(GetDlgItem(IDC_STATIC2)))->SetWindowText(str);

     A =2*asin((L/2)/r);
     str.Format("%0.3f", A*180/3.1415);
     ((CStatic *)(GetDlgItem(IDC_STATIC4)))->SetWindowText(str);

     C=A*r;
     str.Format("%0.3f", C);
     ((CStatic *)(GetDlgItem(IDC_STATIC3)))->SetWindowText(str);
}

VC++ 已知弦高,弦长,求半径,夹角, 弧度

推导过程

相关文章:

  • 2021-09-21
  • 2021-12-19
  • 2022-01-12
  • 2021-09-02
  • 2022-12-23
  • 2021-12-05
  • 2021-11-30
  • 2021-04-05
猜你喜欢
  • 2022-12-23
  • 2021-05-19
  • 2021-12-31
  • 2021-12-19
  • 2022-12-23
相关资源
相似解决方案