不明白为什么
这个程序调试时出错,实在不知道为什么,请高手指点,Thank you!!#include <stdio.h>
int main(void)
{
char ch, a[50];
int i = 0, j;
printf ( "Please input strings:" );
while ( ( ch = getchar () ) != '#' )
{
if ( ch != '.' )
putchar(ch);
else
{
ch = '!';
putchar(ch);
}
while ( 1 )
{
a[i] = ch;
i++;
}
}
j = i;
for ( i = 0; i <= j; i++ )
{
if ( a[i] == '!' )
{
a[i] = '!!';
putchar(a[i]);
}
else
putchar(a[i]);
}
getch();
return 0;
}