字數統計題目內容:你的程序要讀入一篇英文文章,然后統計其中的單詞數來輸出。需要統計的數據為:總的單詞數量;含有1個字母到10個字母的單詞的數量。單詞和單詞的間隔是由以下標點符號形成的:空格、tab、回車換行、逗號、句號、問號、括號、雙引號和冒號。這些符號不能被計入單詞的長度中。因此,對于下面的句子:????"What you see is a very hefty response," said CNN Aviation Correspondent Rene Marsh.其中的單詞為:????What you see is a very hefty response said CNN Aviation Correspondent Rene Marsh共14個。注意雖然這里的response,"后面跟了空格,我們并不能保證所有的輸入中都會有這樣規矩的空格。單引號(表示縮寫的')和連字號(-)視做單詞的一部分,所以“he's”是一個單詞,長度為4;而“F-16 fighter jets”是三個單詞。為了你的程序的方便,輸入數據中不會出現兩個連續的連字號。輸入格式:一篇英文文章。如何知道輸入結束了?如果使用scanf,它會返回這次讀到了幾個變量的值,當這個值小于你要求讀的變量的數量時,表示輸入結束了;如果使用getchar,它在輸入結束時返回EOF。輸出格式:十一個數字,依次是單詞數量和含有1到10個字母的單詞的數量,以空格分隔,最后不含空格。輸入樣例:F-16 fighter jets escorted two passenger planes into Atlanta's Hartsfield-Jackson International Airport on Saturday after a bomb threat made on Twitter was deemed credible, according to military officials.Southwest Airlines Flight 2492 and Delta Flight 1156 landed safely at the airport and were searched by bomb disposal units, according to airline officials. Nothing out of the ordinary was found, officials said.Delta spokesman Morgan Durant said, "It was a Portland, Oregon, to Atlanta, Georgia, flight. Delta is supporting the sweeping process carried out by authorities."輸出樣例:85 2 11 11 11 6 11 10 10 9 1
如何知道輸入結束了,求大神編寫一個C程序!
yuantongxin
2016-04-29 11:44:00