2018卷_26_将字符串1中去掉数字后的其他字符放到字符串2中,并打印。

#include <stdio.h>

int main() {
    
    char str1[20],str2[20];

    printf("输入字符串:
");
    gets(str1);

    int j=0;
    for(int i=0; i<20; i++){
        if (str1[i]>='0' && str1[i]<='9'){
            //空操作
        }else{
            str2[j] = str1[i];
            j++;
        }
    }

    printf("字符串1:
");
    puts(str1);
    printf("字符串2:
");
    puts(str2);

    return 0;
}

原文地址:https://www.cnblogs.com/CPU-Easy/p/14070269.html