I'm pretty new to coding and for the last couple of days I've been exploring WINAPI and trying to learn something new, so I decided to make a calculator (honestly, was harder than I anticipated).
Now I've got everything working, but the only problem left is that when I try to use the calculator, I always get a result that looks like this: 22+22 = 44.0000000. Is there a way I could maybe format the Edit box to show decimal numbers only when needed or maybe there is something I have done wrong in the function?
I included one of the computing functions (used for multiplication) below:
void multiply() {
WCHAR A[20], B[20];
GetWindowText(hOutputBot, A, 20);
GetWindowText(hOutputTop, B, 20);
double Aa = std::stof(A);
double Bb = std::stof(B);
double Res = Bb * Aa;
std::wstring s = std::to_wstring(Res);
LPCWSTR str = s.c_str();
SetWindowTextW(hOutputBot, str);
}