fork download
  1. #include <iostream>
  2.  
  3. using std::cout;
  4. using std::cin;
  5. using std::endl;
  6.  
  7. int main()
  8. {
  9. int rows , columns , width , cycle;
  10. char character;
  11.  
  12. if( !( cin >> rows >> columns >> character >> cycle >> width ) )
  13. {
  14. cout << "Could not successfully read" << endl;
  15. return ( 0 );
  16. }
  17.  
  18. for( int gridrow = 0; gridrow < rows; ++gridrow )
  19. {
  20. for( int elementrow = 0; elementrow < width; ++elementrow )
  21. {
  22. for( int gridcolumn = 0; gridcolumn < columns; ++gridcolumn )
  23. {
  24. for( int elementcolumn = 0; elementcolumn < width; ++elementcolumn )
  25. {
  26. cout << static_cast<char>( character + ( gridrow + gridcolumn ) % cycle );
  27. }
  28. cout << ' ';
  29. }
  30. cout << endl;
  31. }
  32. }
  33.  
  34. return 0;
  35. }
Success #stdin #stdout 0s 3344KB
stdin
5 6 a 4 2
stdout
aa bb cc dd aa bb 
aa bb cc dd aa bb 
bb cc dd aa bb cc 
bb cc dd aa bb cc 
cc dd aa bb cc dd 
cc dd aa bb cc dd 
dd aa bb cc dd aa 
dd aa bb cc dd aa 
aa bb cc dd aa bb 
aa bb cc dd aa bb