C++ 产生随机密码

View Code
#include <time.h>

#include <stdlib.h>

#include <stdio.h>

int main()

{

    int i,j;

    char ss[6];

    srand((unsigned)time(NULL));

    for(i=1;i<=30;i++)

    {



        for(j=0;j<6;j++)

        {

            int temp=rand();

            temp=temp%10;

            if(temp<=3)

            ss[j]=temp+48;

            else

            if(temp<=7)

            ss[j]=temp+97;

            else

            ss[j]=temp+65;

        }

        for( j=0;j<6;j++)

        printf("%c",ss[j]);

        printf("\n");

    }

    

    return 0;

}

你可能感兴趣的:(C++)