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值的转化

 

posted @ 2016-09-18 14:22  于光远  阅读(917)  评论(0编辑  收藏  举报