分享

【编程】随机密码生成代码

 自由撰写者 2013-09-03

  #include

  #include

  #include

  #include

  #include

  void RndPass ( int iLength ) {

  char cAlpha [] = {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,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,0,1,2,3,4,5 ,6,7,8,9};

  for ( ; iLength > 0; iLength-- ) {

  cout<< cAlpha [ rand() % 61 ];

  }

  }

  int main () {

  int iLength;

  int chars;

  int k;

  srand(time(NULL));

  cout << " Coded by ";

  cout << " .:negative zer0:. "<< endl << endl;

  cout << "Enter how many password you want: ";

  cin >> chars;

  cout << endl;

  cout << "Enter password length: ";

  cin >> iLength;

  cout << endl;

  for ( k = 1; k <= chars; k++ ) {

  RndPass(iLength);

  cout << endl << endl;

  }

  return(0);

  }

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多