为什么我的if语句不打印任何内容

时间:2019-12-13 18:02:10

标签: c++

char letter[26]{ 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 
                 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'};
char lett = 'm';

for (int lettindx = 0; lettindx <= 25; lettindx++) {
    int lettindx2 = lettindx + 1;
    if (lettindx2 <=5 && letter[lettindx] == lett) {
        lettindx2 *= 2;
        break;
    }
    if (6 <= lettindx2 <= 10 && letter[lettindx] == lett) {
        int modlett = lettindx2 % 3;
        modlett *= 5;
        break;
    }
    if (11 <= lettindx2 <= 15 && letter[lettindx] == lett) {
        int intpart = lettindx2 / 4;
        cout << letter[intpart - 1] << endl;

有关更多详细信息:我想将m作为值并获得x的值。

为什么我的程序不打印任何内容?

0 个答案:

没有答案