急求高手!请问怎样用c产生6位随机密码,急!
如题,我刚学c不久,麻烦高手给一份源代码,学习一下。谢谢
------解决方案--------------------srand((unsigned)time(NULL));
num = rand() % 100000000;
------解决方案-------------------- char *password= "0123456789abcd...xyz ";
char pass[6];
int id;
srand((unsigned)time(NULL));
for(int i = 0;i <6;i++)
{
id = rand() % 36;
pass[i] = password[id];
}
printf( "%s ",pass);