fork download
  1. #include <iostream>
  2. using namespace std;
  3.  
  4. void i_f(char a, char b, int width) {
  5.  
  6. if(width < 0)
  7. {
  8. cout<<string(width, b)<<endl; return;
  9. }
  10.  
  11. cout <<string(width, a);
  12. i_f(a,b,-width);
  13. i_f(a,b,width-2);
  14. cout<<string(width, a);
  15. i_f(a,b,-width);
  16.  
  17. }
  18.  
  19. int main() {
  20. i_f('X', '-', 5);
  21. return 0;
  22. }
Runtime error #stdin #stdout #stderr 0s 3228KB
stdin
Standard input is empty
stdout
XXXXX
stderr
terminate called after throwing an instance of 'std::length_error'
  what():  basic_string::_S_create