📄 l14.2b
字号:
#printWrite a program which counts the number of five letterwords in its input (define a word as anything betweenblanks, tabs or newlines). Compile and run it, then type "ready".Note that all that is wanted is the total number offive letter words - nothing was said about distinctwords. Just count the number of times exactly fivecharacters appear between spaces.#once #create RefThis is a passage of text which containsexactly twelve words of five letters.Words may appear at the start or at the finalpart of a line. Other words show up inthe middle. Avoid counting seven or eight lettersbut every five must be noted.#usera.out <Ref >xxxgrep 12 xxx >/dev/null#succeed/* one way to count five letter words */ #include <stdio.h>main(){ int since, wdnum, c; since = 0; while ((c=getchar()) != EOF) { if (c == ' ' || c == '\t' || c == '\n') { if (since == 5) wdnum++; since = 0; } else since++; } printf("%d\n", wdnum);}#log#next15.1a 10
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -