
c++中ctr+z结束问题,在vc6.0中为什么要按两次ctr+z才能结束循环
#include<iostream>usingstd::cin;usingstd::cout;usingstd::endl;intmain(){charch;//init...
#include <iostream>
using std::cin;
using std::cout;
using std::endl;
int main()
{
char ch;
// initialize counters for each vowel
int aCnt = 0, eCnt = 0, iCnt = 0,
oCnt = 0, uCnt = 0;
while (cin >> ch) {
// if ch is a vowel, increment the appropriate counter
switch (ch) {
case 'a':
++aCnt;
break;
case 'e':
++eCnt;
break;
case 'i':
++iCnt;
break;
case 'o':
++oCnt;
break;
case 'u':
++uCnt;
break;
}
}
// print results
cout << "Number of vowel a: \t" << aCnt << '\n'
<< "Number of vowel e: \t" << eCnt << '\n'
<< "Number of vowel i: \t" << iCnt << '\n'
<< "Number of vowel o: \t" << oCnt << '\n'
<< "Number of vowel u: \t" << uCnt << endl;
return 0;
} 展开
using std::cin;
using std::cout;
using std::endl;
int main()
{
char ch;
// initialize counters for each vowel
int aCnt = 0, eCnt = 0, iCnt = 0,
oCnt = 0, uCnt = 0;
while (cin >> ch) {
// if ch is a vowel, increment the appropriate counter
switch (ch) {
case 'a':
++aCnt;
break;
case 'e':
++eCnt;
break;
case 'i':
++iCnt;
break;
case 'o':
++oCnt;
break;
case 'u':
++uCnt;
break;
}
}
// print results
cout << "Number of vowel a: \t" << aCnt << '\n'
<< "Number of vowel e: \t" << eCnt << '\n'
<< "Number of vowel i: \t" << iCnt << '\n'
<< "Number of vowel o: \t" << oCnt << '\n'
<< "Number of vowel u: \t" << uCnt << endl;
return 0;
} 展开
3个回答
展开全部
1)这个风格的代码,在实际软件工程应用中,一般是不允许这种风格编写的,没有多大的实用意义,不研究也罢;
2)switch(s)语句中,s是一个整数或者字符变量,不能是字符串变量;
2)switch(s)语句中,s是一个整数或者字符变量,不能是字符串变量;
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
环境问题
本回答被提问者采纳
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
展开全部
ctrl+c吧
已赞过
已踩过<
评论
收起
你对这个回答的评价是?
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询