Problem1356--cpp-6-7 编写程序,对输入的英文句子,判断有多少单词以元音开头,有多少单词以辅音开头,还有多少单词不属于这两类1356: cpp-6-7 编写程序,对输入的英文句子,判断有多少单词以元音开头,有多少单词以辅音开头,还有多少单词不属于这两类
Time Limit: 1 Sec Memory Limit: 128 MB
Submit: 60 Solved: 24
[Submit] [Status] [Web Board] [Creator:]Description
编写一个程序,它每次读取一个单词,直到用户只输入q。然后,该程序指出有多少个单词以元音打头,有多少个单词以辅音打头,
还有多少个单词不属于这两类。为此,方法之一是,使用isalpha( )来区分以字母和其他字符打头的单词,然后对于通过了isalpha( )测
试的单词,使用if或switch语句来确定哪些以元音打头。该程序的运行情况如下:
输入:
The 12 awesome oxen ambled quietly across 15 meters of lawn. q
则输出为:
5 words beginning with vowles
4 words beginning with consonants
2 others
Input
The 12 awesome oxen ambled quietly across 15 meters of lawn. q
Output
5 words beginning with vowles
4 words beginning with consonants
2 others
Sample Input
The 12 awesome oxen ambled quietly across 15 meters of lawn. q
Sample Output
5 words beginning with vowles
4 words beginning with consonants
2 others
Source/Category
[Submit] [Status]