1、
#include <stdio.h> #define STOP '|' int main(void) { char ch; int chnum = 0; int lines = 0; while((ch = getchar()) != STOP) { if(ch != '\n') chnum++; else lines++; } printf("ch number: %d.\n", chnum); printf("lines : %d.\n", lines + 1); return 0; }