C++Primer Plus第六章编程练习.doc

C++Primer Plus第六章编程练习.doc

ID:61502188

大小:34.50 KB

页数:10页

时间:2021-02-07

C++Primer Plus第六章编程练习.doc_第1页
C++Primer Plus第六章编程练习.doc_第2页
C++Primer Plus第六章编程练习.doc_第3页
C++Primer Plus第六章编程练习.doc_第4页
C++Primer Plus第六章编程练习.doc_第5页
资源描述:

《C++Primer Plus第六章编程练习.doc》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库

1、第六章编程练习1、#include#includeintmain(){usingnamespacestd;charch;cin.get(ch);while(ch!='@'){if(isdigit(ch))cin.get(ch);else{if(islower(ch))ch=toupper(ch);elsech=tolower(ch);cout<

2、m>intmain(){usingnamespacestd;doublesum=0;doubleaverage=0;doublenum[10];inti=0,total=0;doubletmp;while(cin>>tmp&&i<10){num[i]=tmp;sum+=num[i];++i;}if(i!=0)average=sum/i;for(intj=0;javerage)++total;cout<<"这些数字的平均值为"<

3、<"并且共有"<intmain(){usingnamespacestd;cout<<"Pleaseenteroneofthefollowingchoices:"<<"c)carnivorep)pianist"<<"t)treeg)gamef";cout<<"Pleaseenterac,p,t,org:";charch;cin>>ch;while(ch!

4、='c'&&ch!='p'&&ch!='t'&&ch!='g'){cout<<"Pleaseenterac,p,t,org:";cin>>ch;}switch(ch){case'c':cout<<"Amapleisatree.";break;case'p':cout<<"Amapleisapianist.";break;case't':cout<<"Amapleisatree.";break;case'g':cout<<"Amapleisagame.";}system("pause"

5、);return0;}4、#includeconstintstrsize=20;structbop{charfullname[strsize];chartitle[strsize];charbopname[strsize];intpreference;};intmain(){std::cout<<"BenevolentOrderofProgrammersReport""a.displaybynameb.displaybytitle""c.displaybybopnamed

6、.diplaybypreference""q.quit";charch;bopmember[5]={{"WimpMacho","EnglishTeacher","DEMON",0},{"RakiRhodes","JuniorProgrammer","BOOM",1},{"CeliaLaiter","SuperStar","MIPS",2},{"HoppyHipman","AnalystTrainee","WATEE",1},{"PatHand","Police","LOOPY",2}};std:

7、:cout<<"Enteryourchoice:";while(std::cin>>ch&&ch!='q'){switch(ch){case'a':for(inti=0;i<5;i++)std::cout<

8、ber[i].bopname<

当前文档最多预览五页,下载文档查看全文

此文档下载收益归作者所有

当前文档最多预览五页,下载文档查看全文
温馨提示:
1. 部分包含数学公式或PPT动画的文件,查看预览时可能会显示错乱或异常,文件下载后无此问题,请放心下载。
2. 本文档由用户上传,版权归属用户,天天文库负责整理代发布。如果您对本文档版权有争议请及时联系客服。
3. 下载前请仔细阅读文档内容,确认文档内容符合您的需求后进行下载,若出现内容与标题不符可向本站投诉处理。
4. 下载文档时可能由于网络波动等原因无法下载或下载错误,付费完成后未能成功下载的用户请联系客服处理。