1. C++ / Говнокод #21122

    −106

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    87. 87
    88. 88
    89. 89
    90. 90
    91. 91
    92. 92
    93. 93
    94. 94
    95. 95
    #include <iostream>
    #include <string>
    #include <algorithm>
     
    using namespace std;
     
    int main()
    {
        int L;
        cin >> L; cin.ignore();
        int H;
        cin >> H; cin.ignore();
        string T;
        getline(cin, T);
        string alphabet[H];
        for (int i = 0; i < H; i++) {
            string ROW;
            getline(cin, ROW);
            //cerr<<ROW<<endl;
            alphabet[i]=ROW;
            //cerr<<alphabet[i]<<endl;
        }
        string answer[H];
        for(int i=0;i<H;++i){
            answer[i]=T;
            for_each(answer[i].begin(), answer[i].end(), [](char& in){ in = ::toupper(in); });
            replace(answer[i].begin(), answer[i].end(), ' ', '1');
            replace(answer[i].begin(), answer[i].end(), ',', '1');
            replace(answer[i].begin(), answer[i].end(), '.', '1');
            replace(answer[i].begin(), answer[i].end(), '@', '1');
            replace(answer[i].begin(), answer[i].end(), '!', '1');
            //cerr<<answer[i]<<endl;
       
           
        }
        for(int i=0;i<H;++i){
        while (answer[i].find("A") != string::npos)
            answer[i].replace(answer[i].find("A"), 1,alphabet[i],0*L,L);
        while (answer[i].find("B") != string::npos)
            answer[i].replace(answer[i].find("B"), 1,alphabet[i],1*L,L);
        while (answer[i].find("C") != string::npos)
            answer[i].replace(answer[i].find("C"), 1,alphabet[i],2*L,L);
        while (answer[i].find("D") != string::npos)
            answer[i].replace(answer[i].find("D"), 1,alphabet[i],3*L,L);
        while (answer[i].find("E") != string::npos)
            answer[i].replace(answer[i].find("E"), 1,alphabet[i],4*L,L);
        while (answer[i].find("F") != string::npos)
            answer[i].replace(answer[i].find("F"), 1,alphabet[i],5*L,L);
        while (answer[i].find("G") != string::npos)
            answer[i].replace(answer[i].find("G"), 1,alphabet[i],6*L,L);
        while (answer[i].find("H") != string::npos)
            answer[i].replace(answer[i].find("H"), 1,alphabet[i],7*L,L);
        while (answer[i].find("I") != string::npos)
            answer[i].replace(answer[i].find("I"), 1,alphabet[i],8*L,L);    
        while (answer[i].find("J") != string::npos)
            answer[i].replace(answer[i].find("J"), 1,alphabet[i],9*L,L);    
        while (answer[i].find("K") != string::npos)
            answer[i].replace(answer[i].find("K"), 1,alphabet[i],10*L,L);
        while (answer[i].find("L") != string::npos)
            answer[i].replace(answer[i].find("L"), 1,alphabet[i],11*L,L);    
        while (answer[i].find("M") != string::npos)
            answer[i].replace(answer[i].find("M"), 1,alphabet[i],12*L,L);  
        while (answer[i].find("N") != string::npos)
            answer[i].replace(answer[i].find("N"), 1,alphabet[i],13*L,L);  
        while (answer[i].find("O") != string::npos)
            answer[i].replace(answer[i].find("O"), 1,alphabet[i],14*L,L);  
        while (answer[i].find("P") != string::npos)
            answer[i].replace(answer[i].find("P"), 1,alphabet[i],15*L,L);    
        while (answer[i].find("Q") != string::npos)
            answer[i].replace(answer[i].find("Q"), 1,alphabet[i],16*L,L);
        while (answer[i].find("R") != string::npos)
            answer[i].replace(answer[i].find("R"), 1,alphabet[i],17*L,L);
        while (answer[i].find("S") != string::npos)
            answer[i].replace(answer[i].find("S"), 1,alphabet[i],18*L,L);
        while (answer[i].find("T") != string::npos)
            answer[i].replace(answer[i].find("T"), 1,alphabet[i],19*L,L);
        while (answer[i].find("U") != string::npos)
            answer[i].replace(answer[i].find("U"), 1,alphabet[i],20*L,L);
        while (answer[i].find("V") != string::npos)
            answer[i].replace(answer[i].find("V"), 1,alphabet[i],21*L,L);
        while (answer[i].find("W") != string::npos)
            answer[i].replace(answer[i].find("W"), 1,alphabet[i],22*L,L);
        while (answer[i].find("X") != string::npos)
            answer[i].replace(answer[i].find("X"), 1,alphabet[i],23*L,L);
        while (answer[i].find("Y") != string::npos)
            answer[i].replace(answer[i].find("Y"), 1,alphabet[i],24*L,L);
        while (answer[i].find("Z") != string::npos)
            answer[i].replace(answer[i].find("Z"), 1,alphabet[i],25*L,L);
        while (answer[i].find("1") != string::npos)  
            answer[i].replace(answer[i].find("1"), 1,alphabet[i],26*L,L);
        }
        for(string x:answer)  {
        cout<<x<<endl;
        }
    }

    решение задачи "считать алфавит, написанный в ASCII графике, и нарисовать этим же ASCII шрифтом текст"

    Запостил: the_user, 06 Сентября 2016

    Комментарии (2) RSS

    Добавить комментарий