|
|
- #include <iostream>
- #include <cstdlib>
- #include <random>
- #include <set>
- using namespace std;
- int main(){
- random_device dev;
- mt19937 engine(dev());
- uniform_int_distribution<int> dis(11, 100);
- set<int> num;
- while (num.size() < 7) {
- int x = dis(engine);
- if (num.count(x) == 0) {
- num.insert(x);
- }
- }
- bool first = true;
- for (int x : num) {
- if (!first) {
- cout << ",";
- }
- cout << "*" << x;
- first = false;
- }
- cout << endl;
- system("pause");
- }
复制代码
|
|
|
|
|
|