fork download
  1. #include <iomanip>
  2. #include <iostream>
  3. #include <string>
  4.  
  5. int main()
  6. {
  7. const unsigned width = 15;
  8. const unsigned num_width = 2;
  9. const unsigned string_width = width - num_width;
  10.  
  11. for (unsigned i = 0; i < width-num_width-1; ++i)
  12. {
  13. std::cout << std::setfill('0') << std::setw(num_width) << i;
  14. std::cout << std::setfill(' ') << std::setw(string_width) << std::string(i+1, '*') << '\n';
  15. }
  16. }
  17.  
Success #stdin #stdout 0s 3272KB
stdin
Standard input is empty
stdout
00            *
01           **
02          ***
03         ****
04        *****
05       ******
06      *******
07     ********
08    *********
09   **********
10  ***********
11 ************