关于 输出 实数的 函数问题
程序代码:
void Main_OnCommand(HWND hwnd, int id, HWND hwndCtl, UINT codeNotify) { switch(id) { case IDC_OK: { TCHAR STR1[256]; TCHAR STR2[256]; GetDlgItemText(hwnd,IDC_EDIT1,STR1,sizeof(STR1)); GetDlgItemText(hwnd,IDC_EDIT2,STR2,sizeof(STR2)); int i1=atoi(STR1); int i2=atoi(STR2); int i3; HWND hwndcombo1=GetDlgItem(hwnd,IDC_COMBO1); int cursel=ComboBox_GetCurSel(hwndcombo1); switch(cursel) { case 0: { i3=i1+i2;}break; case 1: { i3=i1-i2;}break; case 2: { i3=i1*i2;}break; case 3: { i3=i1/i2;}break; } TCHAR STR3[256]; wsprintf(STR3,"%d",i3); SetDlgItemText(hwnd,IDC_EDIT3,STR3); } break; default: break; } }我想将 i1,i2,i3,都改为 double型,但是改后不能输出正确的值, 应该 用哪个 函数输出结果呢,