fork download
  1. #include <iostream>
  2. #include <iomanip>
  3. using namespace std;
  4.  
  5. // Размеры окна
  6. const int WIDTH = 80;
  7. const int HEIGHT = 10;
  8.  
  9. // Цветовая палитра
  10. #define COLOR_BG "\033[44m"
  11. #define COLOR_TEXT "\033[37m"
  12. #define RESET "\033[0m"
  13.  
  14. // Функция рисования букв (ASCII art)
  15. void drawLetter(char letter, int posX, int posY) {
  16. switch(letter) {
  17. case 'И':
  18. cout << setw(posX+1) << "" << COLOR_TEXT << "#" << endl;
  19. cout << setw(posX+1) << "" << COLOR_TEXT << "#" << endl;
  20. cout << setw(posX+1) << "" << COLOR_TEXT << "#" << endl;
  21. cout << setw(posX+1) << "" << COLOR_TEXT << "######" << endl;
  22. cout << setw(posX+1) << "" << COLOR_TEXT << "#" << endl;
  23. cout << setw(posX+1) << "" << COLOR_TEXT << "#" << endl;
  24. break;
  25.  
  26. case 'В':
  27. cout << setw(posX+1) << "" << COLOR_TEXT << "#####" << endl;
  28. cout << setw(posX+1) << "" << COLOR_TEXT << "# #" << endl;
  29. cout << setw(posX+1) << "" << COLOR_TEXT << "# #" << endl;
  30. cout << setw(posX+1) << "" << COLOR_TEXT << "#######" << endl;
  31. cout << setw(posX+1) << "" << COLOR_TEXT << "# #" << endl;
  32. cout << setw(posX+1) << "" << COLOR_TEXT << "# #" << endl;
  33. break;
  34.  
  35. case 'А':
  36. cout << setw(posX+1) << "" << COLOR_TEXT << " #####" << endl;
  37. cout << setw(posX+1) << "" << COLOR_TEXT << " # #" << endl;
  38. cout << setw(posX+1) << "" << COLOR_TEXT << " ########" << endl;
  39. cout << setw(posX+1) << "" << COLOR_TEXT << "# #" << endl;
  40. cout << setw(posX+1) << "" << COLOR_TEXT << "# #" << endl;
  41. break;
  42.  
  43. case 'Н':
  44. cout << setw(posX+1) << "" << COLOR_TEXT << "# #" << endl;
  45. cout << setw(posX+1) << "" << COLOR_TEXT << "# #" << endl;
  46. cout << setw(posX+1) << "" << COLOR_TEXT << "########" << endl;
  47. cout << setw(posX+1) << "" << COLOR_TEXT << "# #" << endl;
  48. cout << setw(posX+1) << "" << COLOR_TEXT << "# #" << endl;
  49. break;
  50.  
  51. case 'О':
  52. cout << setw(posX+1) << "" << COLOR_TEXT << " #####" << endl;
  53. cout << setw(posX+1) << "" << COLOR_TEXT << "# #" << endl;
  54. cout << setw(posX+1) << "" << COLOR_TEXT << "# #" << endl;
  55. cout << setw(posX+1) << "" << COLOR_TEXT << "# #" << endl;
  56. cout << setw(posX+1) << "" << COLOR_TEXT << " #####" << endl;
  57. break;
  58.  
  59. default:
  60. break;
  61. }
  62.  
  63. // Заполняем оставшуюся высоту пустым пространством
  64. while(HEIGHT > posY + 6) {
  65. cout << setw(posX+1) << "" << endl;
  66. ++posY;
  67. }
  68. }
  69.  
  70. // Основная функция для рисования имени
  71. void drawName(const string& name) {
  72. int currentPosX = 1;
  73. for(auto ch : name) {
  74. drawLetter(ch, currentPosX, 0);
  75. currentPosX += 8; // смещение следующей буквы вправо
  76. }
  77. }
  78.  
  79. int main() {
  80. cout << COLOR_BG << endl; // Устанавливаем синий фон
  81. drawName("ИВАНОВ"); // Имя для вывода
  82. cout << RESET << endl; // Возвращаемся к обычному стилю вывода
  83. return 0;
  84. }
Success #stdin #stdout 0.01s 5280KB
stdin
Standard input is empty
stdout