静态文本框产生随机数

void CRandTestDlg::randTest()
{
CStatic *pStatic=(CStatic*)GetDlgItem(IDC_STATIC1);

int max;
int t;
CString cs;
CString result;
max = RAND_MAX;//rand()º¯ÊýËæ»úÊýµÄ×î´óÖµ
//srand()((unsigned)time( NULL ));
srand((unsigned)time(NULL));
for(int i = 0 ; i < 10 ; i++)
{
t = rand()%10;

cs.Format("%d",t); ;

result = cs +","+ result;

pStatic->SetWindowText(result);
}
}

原文地址:https://www.cnblogs.com/zhixing/p/3392774.html