静态文本框产生随机数

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);
}
}

posted on 2013-10-28 16:59  zhixing  阅读(427)  评论(0编辑  收藏  举报