VC中我要在26个字母中随机显示10个,应该如何做?

[复制链接]
查看11 | 回复1 | 2011-3-13 10:41:18 | 显示全部楼层 |阅读模式
RT
回复

使用道具 举报

千问 | 2011-3-13 10:41:18 | 显示全部楼层
<pre id=\"best-answer-content\" class=\"reply-text mb10\">#includestdlib.h
#includestdio.h
#include \"windows.h\"
void main()
{
for(int j = 0; j 10 ;j )
{
srand(GetTickCount());//取随机因子
int i = rand()&;//取一个随机数,该数字为0-25
printf(\"%c\\r\\n\",i 97);//随机数为0到25,而小写字母的asc码为97到122,所以加97
Sleep(1000);//sleep一下,使随机因子取的分散些

}
}
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行