fork download
  1. #include <iostream>
  2. #include <string>
  3. #include <cctype>
  4.  
  5. enum
  6. {
  7. col_count = 5 + 1,
  8. row_count = 7,
  9. glyph_count = 26
  10. };
  11.  
  12. typedef const char row_t[ col_count ];
  13. typedef const row_t glyph_t[ row_count ];
  14. typedef const glyph_t glyph_set_t[ glyph_count ];
  15. typedef std::string line_t[ row_count ];
  16.  
  17. glyph_set_t gs
  18. {
  19. {
  20. {" A "},
  21. {" A A "},
  22. {"A A"},
  23. {"A A"},
  24. {"AAAAA"},
  25. {"A A"},
  26. {"A A"},
  27. },
  28.  
  29. {
  30. {"BBBB "},
  31. {"B B"},
  32. {"B B"},
  33. {"BBBB "},
  34. {"B B"},
  35. {"B B"},
  36. {"BBBB "},
  37. },
  38. //...
  39. };
  40.  
  41. int main()
  42. {
  43. const char* s = "AB";
  44.  
  45. for( int r = 0; r < row_count; ++r )
  46. {
  47. for( const char* p = s; *p; ++p )
  48. {
  49. int set_idx = std::toupper( *p ) - 'A';
  50. // this...
  51. glyph_t& g = gs[ set_idx ];
  52. std::cout << g[ r ] << ' ';
  53. // ...or this (whichever is easier for you)
  54. // std::cout << gs[ set_idx ][ r ] << ' ';
  55. }
  56. std::cout << std::endl;
  57. }
  58. return 0;
  59. }
Success #stdin #stdout 0s 15240KB
stdin
Standard input is empty
stdout
  A   BBBB  
 A A  B   B 
A   A B   B 
A   A BBBB  
AAAAA B   B 
A   A B   B 
A   A BBBB