今日份3

//计算一个句子中除了‘和“的字符的数量,这种情况下可以使用逻辑运算符,并且使用.标示句子结束
#include<stdio.h>
#define juhao '.'
int main()
{
	char ch;
	int charcount = 0;
	while ((ch =getchar()) != juhao)
	{
		if(ch!='"'&&ch!='\'')
			charcount++;
	}
	printf("这有%d个字母",charcount);
	return 0;
}

猜你喜欢

转载自blog.csdn.net/AKG420/article/details/88398076