fork(1) download
  1. #include <algorithm>
  2. #include <cstring>
  3. #include <iostream>
  4. #include <iterator>
  5. #include <string>
  6.  
  7. using namespace std;
  8.  
  9. int main() {
  10. const auto bar = 13U;
  11. string foo;
  12.  
  13. generate_n(back_inserter(foo), bar * 3, [](){
  14. static const char multiplicand[] = "0, ";
  15. static const auto length = strlen(multiplicand);
  16. static auto i = 0U;
  17. return multiplicand[i++ % length];});
  18.  
  19. cout << foo;
  20. }
Success #stdin #stdout 0s 3460KB
stdin
Standard input is empty
stdout
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,