当前位置:网站首页>Statistics tab, space and newline

Statistics tab, space and newline

2020-12-06 20:43:14 Piglets need to learn programming

#include<stdio.h>
int main() {
	int lf, blank, TAB;//lf A newline ,blank Space ,TAB tabs 
	int c;

	lf = 0;
	blank = 0;
	TAB = 0;
	while ((c=getchar()) != EOF) {
		if (c == ' ')
			++blank;
		if (c == '\n')
			++lf;
		if (c == '\t')
			++TAB;
		if (c == '\v')
			++TAB;
	}
	printf("lf=%d", lf);
	printf("blank=%d", blank);
	printf("TAB=%d", TAB);
}

版权声明
本文为[Piglets need to learn programming]所创,转载请带上原文链接,感谢
https://chowdera.com/2020/12/202012062039210136.html