MFC随机数

void CMFCDemoDlg::OnClickedGetrand()
{
    wchar_t str[10];
    //srand((unsigned)time(NULL));
    int num = rand() ;
    _itow_s(num, str, 10);
    GetDlgItem(IDC_Rand)->SetWindowTextW(str);
}

_itow 与_wtoi 实现文本值与int值的转化

原文地址:https://www.cnblogs.com/yuguangyuan/p/5881469.html