#include <stdio.h>
#include <stdbool.h>
#include <string.h>
#include <stdlib.h>
int finding(char *P3,int n)//查找的数组的相对位置,
{
char *q=malloc(100);
q=P3+n-1;
int i=1;
printf("%c\n",*q);
P3=q+1;
while(*P3!='\0')
{
if(*q==*P3)
{
return i;
}
*(P3++);
i++;
}
return 0;
}
char re(char *P3)
{
int fp=0;
char *p1=malloc(100); //目的指针
char *k1=malloc(100); //移动指针
p1=P3;
int n=1;
while(*p1!='\0')
{
while(1)
{
fp=finding(P3,n);
if(fp==0)
{
break;
}
if(fp!=0)
{
k1=p1;
k1+=fp;
while(*k1!='\0')
{*k1=*(k1+1);
k1++;
}
}
}
n++;
p1++;
}
}
int main()
{
char *p=malloc(100);
char *P1=malloc(100);
int i;
printf("请你输入字符串\n");
scanf("%s",P1);
re(P1);
p=P1;
while(*p!='\0')
printf("%c",*p++);
}
任意输入一个字符串,要求去除字符串中的重复字符,只保留一个重复字符 google -->gole i j
最新推荐文章于 2023-12-02 11:34:57 发布