简体   繁体   中英

how to display float value in mfc application

hi i want to pass a float value that compute the execution time of the program to the edit box on the dialog of mfc application.

i already have the equation

clock_t stime, etime;
float t = ((etime - stime) / (double)CLOCKS_PER_SEC);

i'm using the following to pass integer values

parameter->results_dialog->m_atteptsEdit.SetWindowText( itoa(Attempts, val, 10 ) );

Use CString::Format() to format the float and pass that to the SetWindowText function.

clock_t stime, etime;
float t = ((etime - stime) / (double)CLOCKS_PER_SEC);
CString str;
str.Format("%f", t);
parameter->results_dialog->m_atteptsEdit.SetWindowText( str );

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM