C语言 想要把除空格以外字符转为*,出现乱码
{
char word[10];
char _word[10];
int count,i,a;
system("cls");
printf("please enter the chosen word(the size is less than 10 not including blank space):\n");
gets(word);
count = strlen(word);
a = count;
for(i=0;i<count;i++)
{
if(word[i]==' ')
{
_word[i]=' ';
a = a-1;
}
else if( (word[i]>='a' && word[i]<='z') || (word[i]>='A' && word[i]<='Z'))
{
_word[i]='*';
}
}
printf("The word %s has %d characters",&_word,a);
}
for(i = 0; i < count; i++) {
if(word[i] == ' ') {
_word[i] = ' ';
a = a - 1;
} else {
_word[i] = '*';
}
}