C语言填空:删除数字字符

#include <stdio.h>
//调用函数f,从字符串中删除所有的数字字符 asdf32asdfadsfds\0 数组  
#include <string.h> 
void f(char *s)
{
    int i=0;
    while(【1】)
    {
        if(s[i]>='0' && s[i]<='9') 【2】(s+i,s+i+1),【3】;
        i++;   

    }
}
main()
{
    char str[80];
    gets(str);
    f(str);
    puts(str);
    getchar();
 }

 

#include <stdio.h>
//调用函数f,从字符串中删除所有的数字字符 asdf32asdfadsfds\0 数组  
#include <string.h> 
void f(char *s)
{
    int i=0;
    while(s[i]!='\0')
    {
        if(s[i]>='0' && s[i]<='9') strcpy(s+i,s+i+1),i--;
        i++;   

    }
}
main()
{
    char str[80];
    gets(str);
    f(str);
    puts(str);
    getchar();
 }

 

 

posted @ 2023-02-09 10:36  myrj  阅读(132)  评论(0编辑  收藏  举报