fork download
  1. #include <iostream>
  2. #include <cstdlib>
  3. #include <ctime>
  4.  
  5. int main() {
  6. std::srand(std::time(0));
  7. int numero = 0;
  8. while (numero <= 5) {
  9. numero = std::rand() % 10 + 1;
  10. std::cout << numero << " ";
  11. }
  12. std::cout << "\nFinito con: " << numero << std::endl;
  13. return 0;
  14. }
Success #stdin #stdout 0s 5316KB
stdin
Standard input is empty
stdout
8 
Finito con: 8