fork download
  1. #include <iostream>
  2. #include <random>
  3. #include <set>
  4.  
  5. int main() {
  6. std::random_device rd;
  7. std::mt19937 mt(rd());
  8. std::uniform_real_distribution<double> dist(1.0, 10.0;)
  9.  
  10.  
  11. int size;
  12. std::set<int> numbers;
  13. std::cin >> size;
  14.  
  15. while (numbers.size() < size) {
  16. numbers.insert(dist(mt));
  17. }
  18.  
  19. for (const auto& n : numbers) {
  20. std::cout << n << " ";
  21. }
  22.  
  23. return 0;
  24. }
Compilation error #stdin compilation error #stdout 5s 3416KB
stdin
10
compilation info
prog.cpp: In function 'int main()':
prog.cpp:8:58: error: expected ')' before ';' token
     std::uniform_real_distribution<double> dist(1.0, 10.0;)
                                                          ^
prog.cpp:8:59: error: expected primary-expression before ')' token
     std::uniform_real_distribution<double> dist(1.0, 10.0;)
                                                           ^
prog.cpp:13:14: error: 'size' was not declared in this scope
  std::cin >> size;
              ^
stdout
Standard output is empty