编写函数del(char str[])将字符串str中的小写字母删除

编写函数del(char str[])将字符串str中的小写字母删除

问题描述:

//编写函数del(char str[])将字符串str中的小写字母删除。编写主函数,在主函数中定义字符数组s[80],从键盘输入一字符串给s,通过调用函数del,将字符数组s中的小写字母删除,并输出删除后的字符串
#include "stdio.h"
#include "stdlib.h"
main()
{char s[80];
gets(s);
del(s);
printf("\n%s", s );
system("pause");

}
del(char str[])
{/************found************/

}//大佬能用萌新看得懂的语句写吗,刚刚学han'shu

#include "stdio.h"
#include "stdlib.h"
void del(char str[]);

int main()
{char s[80];
gets(s);
del(s);
printf("\n%s", s );
system("pause");
}
void del(char str[])
{/************found************/
    int i = 0;
    int j = 0;
    while (str[j] != '\0')
    {
        if (str[j] < 'a' || str[j] > 'z')
            str[i++] = str[j];
        j++;
    }
    str[i] = '\0';
}

e "stdlib.h"
void del(char str[]);

int main()
{char s[80];
gets(s);
del(s);
printf("\n%s", s );
system("pause");
}
void del(char str[])
{/************found************/
int i = 0;
int j = 0;
while (str[j] != '\0')
{
if (str[j] < 'a' || str[j] > 'z')
str[i++] = str[j];
j++;
}
str[i] = '\0';
}