Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- double x1, x2, x3, sum;
- char t1[10], t11[10], t2[10], t22[10], t3[10], * stopstring;
- // x1
- if ((IsDlgButtonChecked(hDlg, IDC_CHECK1)))
- {
- GetDlgItemText(hDlg, IDC_EDIT2, t1, 100);
- x1 = strtod(t1,&stopstring);
- }
- else
- {
- x1 = 0;
- }
- // x2
- if ((IsDlgButtonChecked(hDlg, IDC_CHECK2)))
- {
- GetDlgItemText(hDlg, IDC_EDIT3, t2, 100);
- x2 = strtod(t2, &stopstring);
- }
- else
- {
- x2 = 0;
- }
- // x3
- if ((IsDlgButtonChecked(hDlg, IDC_CHECK3)))
- {
- cbIndex = SendDlgItemMessage(hDlg, IDC_COMBO2, CB_GETCURSEL, 0, 0);
- if (cbIndex > -1)
- {
- SendDlgItemMessage(hDlg, IDC_COMBO2, CB_GETLBTEXT, cbIndex, (LPARAM)data);
- }
- x3 = strtod(data, &stopstring);
- }
- else
- {
- x3 = 0;
- }
- // result
- sum = x1 + x2 + x3;
- sprintf_s(t22, "%6.3f", sum);
- SetDlgItemText(hDlg, IDC_EDIT4, t22);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement