嗨我想将计算程序执行时间的浮点值传递给mfc应用程序对话框中的编辑框。
我已经有了等式
clock_t stime, etime;
float t = ((etime - stime) / (double)CLOCKS_PER_SEC);
我正在使用以下内容传递整数值
parameter->results_dialog->m_atteptsEdit.SetWindowText( itoa(Attempts, val, 10 ) );
答案 0 :(得分:2)
使用CString :: Format()格式化float并将其传递给SetWindowText函数。
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 );