Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/cplusplus/138.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/355.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++ 如何修复艺术ascii,我点击一个字母就可以了,但输入一个相位艺术出来就错了_C++_C_Compiler Errors_Ascii - Fatal编程技术网

C++ 如何修复艺术ascii,我点击一个字母就可以了,但输入一个相位艺术出来就错了

C++ 如何修复艺术ascii,我点击一个字母就可以了,但输入一个相位艺术出来就错了,c++,c,compiler-errors,ascii,C++,C,Compiler Errors,Ascii,我需要的帮助是这个脚本转换艺术ascii 如果我把每封信都单独打出来,一切都会好起来,它们会像它们应该的那样出来 但是,如果我试着输入一个短语,或者多个字母,那么艺术是完全错误的 #define BUFF_SIZE 256 #include <stdio.h> #include <string.h> void print(char* string) { int len = strlen(string); int ind, ctr; char ptr

我需要的帮助是这个脚本转换艺术ascii

如果我把每封信都单独打出来,一切都会好起来,它们会像它们应该的那样出来 但是,如果我试着输入一个短语,或者多个字母,那么艺术是完全错误的

#define BUFF_SIZE 256
#include <stdio.h>
#include <string.h>
void print(char* string) {
    int len = strlen(string);
    int ind, ctr;
    char ptr;
    for(ind = 0; ind < 3; ++ind) {
        for(ctr = 0; ctr < len; ++ctr) {
            ptr = string[ctr];
            switch(ptr) {
            case 'A':
                switch(ind) {
                case 0:
                    printf(" /\\ ");
                    break;
                case 1:
                    printf("/~~\\ ");
                    break;
                case 2:
                    printf("      ");
                    break;
                default:
                    break;
                }
                break;
            case 'B':
                switch(ind) {
                case 0:
                    printf(" __ ");
                    break;
                case 1:
                    printf("|__)");
                    break;
                case 2:
                    printf("|__)");
                    break;

                default:
                    break;
                }
                break;
            case 'C':
                switch(ind) {
                case 0:
                    printf(" __ ");
                    break;
                case 1:
                    printf("/  ` ");
                    break;
                case 2:
                    printf("\\__, ");
                    break;
                default:
                    break;
                }
                break;
            case 'D':
                switch(ind) {
                case 0:
                    printf(" __  ");
                    break;
                case 1:
                    printf("|  \\ ");
                    break;
                case 2:
                    printf("|__/ ");
                    break;
                default:
                    break;
                }
                break;
            case 'E':
                switch(ind) {
                case 0:
                    printf(" ___ ");
                    break;
                case 1:
                    printf("|__  ");
                    break;
                case 2:
                    printf("|___ ");
                    break; 

                default:
                    break;
                }
                break;
            case 'F':
                switch(ind) {
                case 0:
                    printf(" ___ ");
                    break;
                case 1:
                    printf("|__  ");
                    break;
                case 2:
                    printf("|    ");
                    break;

                default:
                    break;
                }
                break;
            case 'G':
                switch(ind) {
                case 0:
                    printf(" __   ");
                    break; 
                case 1:
                    printf("/ _`  ");
                    break;
                case 2:
                    printf("\\__> ");
                    break;

                default:
                    break;
                }
                break;
            case 'H':
                switch(ind) {
                case 0:
                    printf("|__| ");
                    break;
                case 1:
                    printf("|  | ");
                    break;
                case 2:
                    printf("     ");
                    break;
                default:
                    break;
                }
                break;
            case 'I':
                switch(ind) {
                case 0:
                    printf(" | ");
                    break;
                case 1:
                    printf(" | ");
                    break;
                case 2:
                    printf("   ");
                    break;  
                default:
                    break;
                }
                break;
            case 'J':
                switch(ind) {
                case 0:
                    printf("    | ");
                    break;
                case 1:
                    printf("\\__/ ");
                    break;
                case 2:
                    printf("      ");
                    break;
                default:
                    break;
                }
                break;
            case 'K':
                switch(ind) {
                case 0:
                    printf("|__/ ");
                    break;
                case 1:
                    printf("|  \\ ");
                    break;
                case 2:
                    printf("      ");
                    break; 
                default:
                    break;
                }
                break;
            case 'L':
                switch(ind) {
                case 0:
                    printf("|    ");
                    break;
                case 1:
                    printf("|___ ");
                    break;
                case 2:
                    printf("     ");
                    break;
                default:
                    break;
                }
                break;
            case 'M':
                switch(ind) {
                case 0:
                    printf("|\\/|");
                    break;
                case 1:
                    printf("|  | ");
                    break;
               case 2:
                    printf("     ");
                    break;
                default:
                    break;
                }
                break;
            case 'N':
                switch(ind) {
                case 0: 
                    printf("|\\ | ");
                    break;
                case 1:
                    printf("| \\| ");
                    break;
                case 2:
                    printf("      ");
                    break;
                default:
                    break;
                }
                break;
            case 'O':
                switch(ind) {
                case 0:
                    printf(" __  ");
                    break; 
                case 1:
                    printf("/  \\ ");
                    break;
                case 2:
                    printf("\\__/ ");
                    break;

                default:
                    break;
                }
                break;
            case 'P':
                switch(ind) {
                case 0:
                    printf(" __ ");
                    break;
                case 1:
                    printf("|__) ");
                    break;
                case 2:
                    printf("|    ");
                    break;
                default:
                    break;
                }
                break;
            case 'Q':
                switch(ind) {
                case 0:
                    printf(" __   ");
                    break;
                case 1:
                    printf("/  \\ ");
                    break;
                case 2:
                    printf("\\__X ");
                    break;

                default:
                    break;
                }
                break;
            case 'R':
                switch(ind) {
                case 0:
                    printf(" __  ");
                    break;
                case 1:
                    printf("|__) ");
                    break;
                case 2:
                    printf("|  \\ ");
                    break;

                default:
                    break;
                }
                break;
            case 'S':
                switch(ind) {
                case 0:
                    printf(" __ ");
                    break;
                case 1:
                    printf("/__` ");
                    break;
                case 2:
                    printf(".__/ ");
                    break;

                default:
                    break;
                }
                break;
            case 'T':
                switch(ind) {
                case 0:
                    printf(" ___ ");
                    break;
                case 1:
                    printf("  | ");
                    break;
                case 2:
                    printf("  | ");
                    break;

                default:
                    break;
                }
                break;
            case 'U':
                switch(ind) {
                case 0:
                    printf("|  | ");
                    break;
                case 1:
                    printf("\\__/ ");
                    break;
                case 2:
                    printf("      ");
                    break;
                default:
                    break;
                }
                break;
            case 'V':
                switch(ind) {
                case 0:
                    printf("\\  / ");
                    break;
                case 1:
                    printf(" \\/  ");
                    break;
                case 2:
                    printf("      ");
                    break;
                default:
                    break;
                }
                break;
            case 'W':
                switch(ind) {
                case 0:
                    printf(" |  |  ");
                    break;
                case 1:
                    printf(" |/\\| ");
                    break;
                case 2:
                    printf("       ");
                    break;
                default:
                    break;
                }
                break;
            case 'X':
                switch(ind) {
                case 0:
                    printf(" \\_/ ");
                    break;
                case 1:
                    printf(" / \\ ");
                    break;
                case 2:
                    printf("      ");
                    break;
                default:
                    break;
                }
                break;
            case 'Y':
                switch(ind) {
                case 0:
                    printf(" \\ / ");
                    break;
                case 1:
                    printf("  |  ");
                    break;
                case 2:
                    printf("     ");
                    break;
                default:
                    break;
                }
                break;
            case 'Z':
                switch(ind) {
                case 0:
                    printf("  __  ");
                    break;
                case 1:
                    printf("  /  ");
                    break;
                case 2:
                    printf("  /_  ");
                    break;
                default:
                    break;
                }
                break;
            default:
                break;
            }
        }
        printf("\n");
    }
    printf("\n");
}
void print(char* string);

int main(int argc, char *argv[]) {

    if (argc > 1) {

        char text[BUFF_SIZE] = {0};

        int n = 1;
        while (n < argc) {
            strcat(text, argv[n]);
            strcat(text, " ");
            n++;
        }

        n = 0;
        char ptr;
        while(text[n]) {
            ptr = text[n];
            text[n] = (toupper(ptr));
            n++;
        }

        print(text);

    } else {
        printf("\n Digite o texto a ser convertido \n");
        char text[BUFF_SIZE];
        fgets(text, sizeof(text), stdin);
        int i = 0;
        char ptr;
        while(text[i]) {
            ptr = text[i];
            text[i] = (toupper(ptr));
            ++i;
        }
        print(text);
    }
    return(0);
}
#定义BUFF#u大小256
#包括
#包括
无效打印(字符*字符串){
int len=strlen(字符串);
国际工业中心;
char-ptr;
对于(ind=0;ind<3;++ind){
对于(ctr=0;ctr /\  __ 
/~~\ |__)
      |__)
        case 'A':
            switch(ind) {
            case 0:
                printf(" /\\   ");   /* <--- added 2 spaces */
                break;
            case 1:
                printf("/~~\\  ");   /* <--- added 1 space */
                break;
            case 2:
                printf("      ");
                break;
            default:
                break;
            }
            break;
 /\    __ 
/~~\  |__)
      |__)
        case 'A':
            switch(ind) {
            case 0:
                printf("      ");    /* <--- moved from case 2 */
                break;
            case 1:
                printf(" /\\   ");   /* <--- moved from case 0 */
                break;
            case 2:
                printf("/~~\\  ");   /* <--- moved from case 1 */
                break;
            default:
                break;
            }
            break;
       __ 
 /\   |__)
/~~\  |__)
        case 'A': switch(ind) {
            case 0: printf("      "); break;
            case 1: printf(" /\\  "); break;
            case 2: printf("/~~\\ "); break;
        } break;
        case 'B': switch(ind) {
            case 0: printf(" __  "); break;
            case 1: printf("|__) "); break;
            case 2: printf("|__) "); break;
        } break;
        ...
...
   case 'A': case 'a':    // catch upper- and lower-case 'A'
...