#include<stdio.h>
#include<string.h>
void changestr(const char *pin,char *pout)
{
const char *pin_1=pin;
const char *pin_2=pin;
char * pout_1=pout;
int flag=0;
*pout_1=*pin_1;
pin_1++;
pout_1++;
while (*pin_1 !='\0')
{
for (flag=0, pin_2=pin; pin_2 < pin_1; pin_2++)
{
if (*pin_1 == *pin_2)
{
flag=1;
break;
}
}
if (flag==0)
{
*pout_1=*pin_1;
pin_1++;
pout_1++;
}
else
{
pin_1++;
}
}
*pout_1 = '\0';
}
int main()
{
char *pin="google";
char pout[256];
changestr(pin,pout);
printf("%s\n",pout);
return 0;
}
华为机试题目--2011-9-14 10:30--11:30(另外解法)
最新推荐文章于 2024-10-18 18:49:34 发布