|
#---------------随机取j个字母----------------------------
public function getLetter(in j,out Result)
{
auto i,RandNum,TempLetter;
static Letter[ ]= {"a","b","c", "d","e","f","g","h","i","j","k","l","m","n","o","p","q","r","s","t","u","v","w","x","y","z"};
if(j<0) j=-j;
j=int(j);
for (i=0; i<j; i++)
{
RandNum = int(rand()*25+1);#随机从0-25取一个数字
TempLetter=Letter[RandNum];
if(TempLetter=="") pause("程序有错!");
Result=Result&TempLetter;
}
printf(Result);
return 0;
}
for (i=0;i<10;i++)
{
getLetter(0);
}
[ 本帖最后由 madduck 于 2007-6-29 11:11 编辑 ] |
评分
-
查看全部评分
|