能帮忙改一下程序吗,他在字符和数字连在一起时出错了。还有能写一个检查数字串是否为字母串

2025-06-29 05:34:18
推荐回答(1个)
回答1:

/*函数功能:检查字符串是否为数字串*/
void cat1(char cata[])
{
    int i = 0;
while(cata[i] != '\0')
{
if((cata[i]>='0')&&(cata[i]<='9'))
{
printf("该函数为数字串\n");
return;
}
i++;
}

    printf("该函数不是数字串\n");
}

将函数cat1修改下。