
//C++生成随机密码
#include<iostream>
#include<ctime>
using namespace std;
const int LEN_NAME=4;
char *rand_str(char *str,const int len)
{
int i;
for(i=0;i<len;++i)
str[i]='A'+rand()%26;
str[++i]='\0';
return str;
}
void main()
{
srand(time(NULL));
int i;
char name[LEN_NAME+1];
for(i=0;i<20;++i)
{
cout<<rand_str(name,LEN_NAME)<<endl;
}
}



初级程序员
by: 绝影007 发表于:2016-07-05 21:45:40 顶(0) | 踩(0) 回复
无限循环 有什么意义?
回复评论