?? 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 + -