c语言switch语句中break的用法
英词吧
人气:2.37W
在C语言中break的意思就是执行到这一步下面的都不执行了。比如从case 1开始执行,如果没break,则下面的语句都会执行,直到遇到下一个break或者当前代码块运行完毕。下面小编就来为大家介绍c语言switch语句中break的用法。 #include<stdio.h>intmain(){intge,shi,bai,qian,wan,num,place; printf("输入一个0-99999的正整数:n");scanf("%d",&num);if(num>9999)place=5;elseif(num>999)place=4;elseif(num>99)place=3;elseif(num>9) place=2; elseplace=1; printf("这个数一共%d位。n",place);wan=num/10000; qian=(num-wan*10000)/1000; bai=(num-wan*10000-qian*1000)/100;shi=(num-wan*10000-qian*1000-bai*100)/10;ge=num-wan*10000-qian*1000-bai*100-shi*10;switch(place) { case5:printf("万位数为%d;n",wan);case4:printf("千位数为%d;n",qian);case3:printf("百位数为%d;n",bai);case2:printf("十位数为%d;n",shi);case1:printf("个位数为%d;n",ge);/*case1:printf("个位数为%d;n",ge);//break;case2:printf("十位数为%d;n",shi);//break;case3:printf("百位数为%d;n",bai);//break;case4:printf("千位数为%d;n",qian);//break;case5:printf("万位数为%d;n",wan);*/} switch(place) { case1:printf("反序数为%d.n",ge);break; case2:printf("反序数为%d%d.n",ge,shi);break; case3:printf("反序数为%d%d%d.n",ge,shi,bai);break; case4:printf("反序数为%d%d%d%d.n",ge,shi,bai,qian);break;case5:printf("反序数为%d%d%d%d%d.n",ge,shi,bai,qian,wan);}return0; }
相关文章:
- c语言中getchar的用法函数用法
- The english we speak(BBC教学)第176期:Corporate speak 企业用语
- c语言中continue和break的用法
- 蒋健棠英语实用句子(81):She was decked out in her nicest&nbs
- c语言break的用法
- 蒋健棠英语实用句子(103):I think it will catch on quickly
- c语言switch的用法
- c语言中break的用法
- c语言中switch的用法
- The english we speak(BBC教学)第74期: throw the book at用规矩严惩
热门推荐
- 1c语言中while的用法
- 2The english we speak(BBC教学)第180期:Everything but the kitchen sink 带的东西太多了
- 3The english we speak(BBC教学)第243期:Social media words 社交媒体用语
- 4The english we speak(BBC教学)第291期:White collar worker/blue collar worker 白领和蓝领
- 5c语言里while的用法
- 6蒋健棠英语实用句子(85):His work has been dissected
- 7The english we speak(BBC教学)第23期:weather idioms 有关天气的谚语
- 8The english we speak(BBC教学)第196期:water off a duck's back 毫无影响
- 9每日一句口语 第543期:brings you back down to earth回到现实 每日一句|bring|back|earth
- 10c语言while的用法
猜你喜欢
- 1The english we speak(BBC教学)第143期:Baby Talk 儿童用语
- 2The english we speak(BBC教学)第20期:what's his face 那个长相的人
- 3蒋健棠英语实用句子(79):He withered away from overwork
- 4The english we speak(BBC教学)第210期:Wow factor 令人惊叹的元素
- 5c语言getchar的用法
- 6The english we speak(BBC教学)第194期:throw the baby out with the bathwater
- 7校园英语口语习惯用语 第177期:know something backwards
- 8c语言do while的用法
- 9bank deposits subject to withdrawal by check是什么意思、英文翻译及中文解释
- 10c语言中do while的用法
- 11The english we speak(BBC教学)第139期:Two phrases about fatherhood 两个与父亲身份有关的短语
- 12switch的用法和短语例句
- 13校园英语口语习惯用语第177期:know something backwards
- 14名人婚礼防泄密的那些招数 How Celebrities Keep Their Weddings a Secret
- 15英语寓言故事 The Bitch and Her Whelps
今日热门
- 1蒋健棠英语实用句子(120):I have to pick up the slack
- 2The english we speak(BBC教学)第202期:Internet speak 网络用语
- 3bank loans which are based on funds which have been allocated by the state to the bank是什么意思、英文翻译及中文解
- 4C语言switch语句
- 5初中语文文言文固定结构的用法
- 6文言文中而的用法
- 7C语言的读书心得
- 8最新switch用法语句大全
- 9bank loans which are based on funds which have been allocated by the state to the bank是什么意思、英文翻译及中文解
- 10每日一句口语 第2509期:The world may be full of cheating, however we never lack friends w
更多推荐
- 1个人计算会议是什么意思、英文翻译及中文解释
- 2average annual rainfall是什么意思、英文翻译及中文解释大纲
- 3【有声】观众推测《顶楼3》中朱锡京会死的理由
- 4普京阿博特会谈敦促加快调查马航班机坠毁事件
- 5英语口语讲解"Hit the road"
- 6不接地的是什么意思、英文翻译及中文解释范例
- 7厂用电率是什么意思、英文翻译及中文解释
- 8促进剂是什么意思、英文翻译及中文解释提纲
- 9出乎意料的英文短语
- 10“羊驼肉”成澳洲餐桌美味
- 11介绍朋友英语作文初一
- 12AIII BIV族元素生产是什么意思、英文翻译及中文解释
- 13商务英语和英语专业的区别
- 14level of hazardous material incident是什么意思、英文翻译及中文解释
- 15入门必备 : 介词「à」的用法梳理