c++翻译请帮忙下谢谢急哭了

来源:百度知道 编辑:UC知道 时间:2024/06/24 09:36:32
switch ( next_char )
{
case 'a': case 'A':
case 'e': case 'E':
case 'i': case 'I':
case 'o': case 'O':
case 'u': case 'U':
++vowel_cnt;
break;
// ...
}
Loop Statements
A loop statement executes a statement or statement block as long as the
condition expression evaluates as true. Our program requires two loop
statements, one nested within the other:

前面是一个switch语句,就不用说了吧!
底下的英文是这个意思:
循环语句
循环语句完成当条件表达式为真时执行一条代码或代码块,我们的程序要求用两个循环语句,一个嵌套另一个。

就是说如果next_char 是a,A,e,E,i,I,o,O,U,u的时候++vowel_cnt
等价于
switch ( next_char )
{
case 'a':++vowel_cnt; break;
case 'A': ++vowel_cnt; break;
case 'e':++vowel_cnt; break;
case 'E': ++vowel_cnt; break;
case 'i':++vowel_cnt; break;
case 'I': ++vowel_cnt; break;
case 'o':++vowel_cnt; break;
case 'O': ++vowel_cnt; break;
case 'u':++vowel_cnt; break;
case 'U': ++vowel_cnt; break;

// ...
}