MFC Question
-
Hey long time no see! Anywayz, What would be the easiest way to get IDC_EDIT1 (total amount) be split into dollars and change... IDC_EDIT1 (Total) = 1.50 IDC_EDIT2 (Dollars) = 1.00 IDC_EDIT3 (Change) = 0.50 How would i split 1.50 into 1.00 and 0.50? Or how would i split $15.68 into $15.00 and 0.68? Any help would b greatful, nice to see you all again! /* Just a Human Trying to Live in a Computers World. */
-
Hey long time no see! Anywayz, What would be the easiest way to get IDC_EDIT1 (total amount) be split into dollars and change... IDC_EDIT1 (Total) = 1.50 IDC_EDIT2 (Dollars) = 1.00 IDC_EDIT3 (Change) = 0.50 How would i split 1.50 into 1.00 and 0.50? Or how would i split $15.68 into $15.00 and 0.68? Any help would b greatful, nice to see you all again! /* Just a Human Trying to Live in a Computers World. */
-
Hey long time no see! Anywayz, What would be the easiest way to get IDC_EDIT1 (total amount) be split into dollars and change... IDC_EDIT1 (Total) = 1.50 IDC_EDIT2 (Dollars) = 1.00 IDC_EDIT3 (Change) = 0.50 How would i split 1.50 into 1.00 and 0.50? Or how would i split $15.68 into $15.00 and 0.68? Any help would b greatful, nice to see you all again! /* Just a Human Trying to Live in a Computers World. */
NewbieStats wrote: How would i split 1.50 into 1.00 and 0.50? Or how would i split $15.68 into $15.00 and 0.68? float a=15.68; IDC_EDIT2 (Dollars) = int(a); IDC_EDIT3 (Change) = a-int(a);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers, Alok Gupta
-
Hey long time no see! Anywayz, What would be the easiest way to get IDC_EDIT1 (total amount) be split into dollars and change... IDC_EDIT1 (Total) = 1.50 IDC_EDIT2 (Dollars) = 1.00 IDC_EDIT3 (Change) = 0.50 How would i split 1.50 into 1.00 and 0.50? Or how would i split $15.68 into $15.00 and 0.68? Any help would b greatful, nice to see you all again! /* Just a Human Trying to Live in a Computers World. */
Hello, If you have CString's than this code will do the trick for you:
CString sTotal = "15.68"; CString sChange = "0." + sTotal.Right(2); CString sDollars = sTotal.Left(sTotal.Find('.')) + ".00";
Hope this helps. I also got the blogging virus..[^]