fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <vector>
  4. #include <ctime>
  5. using namespace std;
  6.  
  7.  
  8. int main()
  9. {
  10. srand(time(0));
  11. string numbers = ("");
  12. vector<string> holdNumbers;
  13. bool getNumberLoopEnd = false;
  14. int loopCounter = 0;
  15.  
  16. for (auto i = 0; i < 5; i++)
  17. {
  18. while(getNumberLoopEnd != true)
  19. {
  20. for(int i = 0; i < 7; i++)
  21. {
  22. numbers = '0' + rand() % 10;
  23. //cout << numbers;
  24. }
  25. holdNumbers.push_back(numbers);
  26. loopCounter++;
  27. if(loopCounter == 7)
  28. {
  29. break;
  30. }
  31. }
  32.  
  33. for(int i = 0; i < 7; i++)
  34. {
  35. cout << holdNumbers[i];
  36. }
  37. cout<< '\n';
  38. numbers = "";
  39. holdNumbers.clear();
  40. getNumberLoopEnd = false;
  41. loopCounter = 0;
  42. }
  43. }
Success #stdin #stdout 0s 3476KB
stdin
Standard input is empty
stdout
5782021
2002750
9918467
3888175
2584514