#include "stdafx.h"
#include "stdio.h"
int _tmain(int argc, _TCHAR* argv[])
{
#define size 1000
void deleteRepeats(char []);
char message[size];
printf("Please enter a sentence:\n");
gets(message);
deleteRepeats(message);
return 0;
}
void deleteRepeats(char string[])
{
char a,b;
int i,j;
i=0;
for(i;i!=' ';i++)
{
a=string[i];
for(j=i+1;j!=' ';j++)
{
b=string[j];
if(a==b)
{
string[j]=' ';
}
else
{
;
}
}
}
int string2[1000];
int z,x;
x=0;
for(z=0;string[z]!='\0';z++)
{
if(string[z]!=' ')
{
string2[x]=string[z];
x++;
}
else
{
;
}
}
printf("%s",string2);
}
哪里错了,为什么输入什么都只出现第一个字母???