方法2

2019-05-09  本文已影响0人  Jianbaozi
#include<iostream>
#include<string>
#include<random>
#include<ctime>
using namespace std;
int main() {
    srand(time(NULL));
    for (int i = 0; i < 5; ++i) {
        string s;
        for (int i = 0; i < 10; ++i) {
            switch (rand() % 3)
            {
            case 0:s = s + char(rand() % 26 + 'a'); break;
            case 1:s = s + char(rand() % 26 + 'A'); break;
            case 2:s = s + char(rand() % 10 + '0'); break;
            }
        }
        cout << s << endl;
    }
    system("pause");
    return 0;
}
上一篇 下一篇

猜你喜欢

热点阅读