字?jǐn)?shù)統(tǒng)計(jì)題目內(nèi)容:你的程序要讀入一篇英文文章,然后統(tǒng)計(jì)其中的單詞數(shù)來輸出。需要統(tǒng)計(jì)的數(shù)據(jù)為:總的單詞數(shù)量;含有1個(gè)字母到10個(gè)字母的單詞的數(shù)量。單詞和單詞的間隔是由以下標(biāo)點(diǎn)符號(hào)形成的:空格、tab、回車換行、逗號(hào)、句號(hào)、問號(hào)、括號(hào)、雙引號(hào)和冒號(hào)。這些符號(hào)不能被計(jì)入單詞的長度中。因此,對(duì)于下面的句子:????"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個(gè)。注意雖然這里的response,"后面跟了空格,我們并不能保證所有的輸入中都會(huì)有這樣規(guī)矩的空格。單引號(hào)(表示縮寫的')和連字號(hào)(-)視做單詞的一部分,所以“he's”是一個(gè)單詞,長度為4;而“F-16 fighter jets”是三個(gè)單詞。為了你的程序的方便,輸入數(shù)據(jù)中不會(huì)出現(xiàn)兩個(gè)連續(xù)的連字號(hào)。輸入格式:一篇英文文章。如何知道輸入結(jié)束了?如果使用scanf,它會(huì)返回這次讀到了幾個(gè)變量的值,當(dāng)這個(gè)值小于你要求讀的變量的數(shù)量時(shí),表示輸入結(jié)束了;如果使用getchar,它在輸入結(jié)束時(shí)返回EOF。輸出格式:十一個(gè)數(shù)字,依次是單詞數(shù)量和含有1到10個(gè)字母的單詞的數(shù)量,以空格分隔,最后不含空格。輸入樣例: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
如何知道輸入結(jié)束了,求大神編寫一個(gè)C程序!
yuantongxin
2016-04-29 11:44:00