#include <stdio.h>
#include <string.h>
void fun(char s[], char t[])
{
/********** Begin **********/
int i;
for (; *s != '\0'; *s++)
{
i = *s;
if (i % 2 != 0)
{
*t = *s;
*t++;
}
}
*t++ = '\0';
/********** End ***********/
}
void main()
{
char s[100], t[100];
printf("\nPlease enter string S:");
scanf_s("%s",s,100);
fun(s, t);
printf("\nThe result is: %s\n", t);
}
函数fun的功能是:将s所指字符串中ASCII值为偶数的字符删除,字符串中剩余字符形成一个新串放在t所指的数组中。 例如,若s所指字符串中的内容为:“ABCDEFG12345“,其中字符B的A
最新推荐文章于 2024-06-06 20:32:36 发布