while 语句的用法#include //#include using namespace std;int main() { char ch; int aCnt=0,eCnt=0,iCnt=0,oCnt=0,uCnt=0,consonantCnt = 0; while ( cin >> ch ) switch ( ch ) { case 'a':case 'A':++aCnt;break;case 'e':case 'E':++eCnt;break;case 'i':cas
来源:学生学帮网 编辑:学帮网 时间:2024/07/07 03:08:50
while 语句的用法
#include
//#include
using namespace std;
int main()
{
char ch;
int aCnt=0,eCnt=0,iCnt=0,oCnt=0,uCnt=0,
consonantCnt = 0;
while ( cin >> ch )
switch ( ch )
{
case 'a':case 'A':
++aCnt;
break;
case 'e':case 'E':
++eCnt;
break;
case 'i':case 'I':
++iCnt;
break;
case 'o':case 'O':
++oCnt;
break;
case 'u':case 'U':
++uCnt;
break;
default:
if ( isalpha( ch ))
++consonantCnt;
break;
}
cout
你这个while的判断是ch的值,ch是获取的按键值,是其ascii码,不可能为零的,所以不会退出循环,哪怕你输的是零,建议可以加个判断,例如while((cin>>ch)!=`0`)
while 语句的用法#include //#include using namespace std;int main() { char ch; int aCnt=0,eCnt=0,iCnt=0,oCnt=0,uCnt=0,consonantCnt = 0; while ( cin >> ch ) switch ( ch ) { case 'a':case 'A':++aCnt;break;case 'e':case 'E':++eCnt;break;case 'i':cas
谁能讲一下c++中while语句的用法?详细一点的
While的用法
和while的用法!
while的用法?
while的具体用法
while的所有用法
求帮忙while语句改为for语句#include main (){while ((c=getchar()) =EOF)putchar(c);}
for语句while语句的区别
c语言循环语句的书写顺序求1到5的积,程序如下#include main() { int a,b; a=1; b=2; while(b
C语言:while循环语句输出问题#include void main(){int i=1,sum=0;while(i
C++中while语句的用法while ( *pin++) ++len; //这里写在大括号之外是什么意思?书上写的.{ pin = pin - len - 1; cout
When While As 的用法
while和when的用法
when 和 while的用法
when和while的用法
while的用法(英语)
include的用法帮帮我吧!