/*4.利用 if else 语句编写程序读取输入,直到#。用一个感叹号代替每个句号,将原有的每个感叹号用两个感叹号代替,最后报告进行了多少次替代。*/
#include<stdio.h>
#include<stdlib.h>
#define STOP '#'
int main()
{
char a;
int i = 0, j =0;
printf("Please input:");
while ((a = getchar()) != STOP)
{
if (a == '.')
{
putchar('!');
i++;
}
else if (a == '!')
{
putchar('!');
putchar('!');
j++;
}
else
putchar(a);
}
printf("\n%d times of replacements\n", i + j);
system("pause");
return 0;
}