// WhileSwitchBreak.cpp : 定义控制台应用程序的入口点。
//
#include "stdafx.h"
#include <iostream>
using namespace std;
int _tmain(int argc, _TCHAR* argv[])
{
int i = 0;
while (true)
{
switch (i)
{
case 1:
break;
default:
break;
}
cout<<i <<" ";
i++;
if (i>10)
{
break;
}
}
cin>>i;
return 0;
}
结果为:0 1 2 3 4 5 6 7 8 9 10
转载于:https://www.cnblogs.com/chunyou128/archive/2011/10/27/2227069.html
最后
以上就是现代便当最近收集整理的关于当在while里的switch里用break的话,只能跳出switch!的全部内容,更多相关当在while里内容请搜索靠谱客的其他文章。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复