欢迎来到天天文库
浏览记录
ID:52238922
大小:93.37 KB
页数:10页
时间:2020-03-25
《C++Primer Plus(第6版)中文版编程练习答案--第六章.pdf》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、注释:这些程序是唐刀在学习的时候编写的,其中可能存在错误和不足,大家做个参考就好。1.#include#includeintmain(){usingnamespacestd;cout<<"请输入字符,@符号结束"<2、字母然后输出}}elseif(!isdigit(ch))//非数字非字母则原样输出cout<usingnamespacestd;intmain(){doublearr[10]={0,0,0,0,0,0,0,0,0,0};cout<<"输入10个值,当输入为非数字时结束:"<>arr[count]){count++;}doublesum=0;doubleaver=0;for(inti=0;i3、+)sum+=arr[i];aver=sum/count;intn=0;for(intj=0;javer)n++;}cout<<"输入"<usingnamespacestd;intmain(){cout<<"Pleaseenteroneoffollowingchoices:"<4、"c)carnivore"<>temp;while(temp!='c'&&temp!='p'&&temp!='t'&&temp!='g'){cout<<"Pleaseenterac,p,t,org:"<>temp;}2switch(temp){case'c':cout<<"Amapleisacarnivore"<5、anist"<usingnamespacestd;structbop{charfullname[20];chartitle[20];charbopname[20];intpreference;};intmain(){bopmember[5]={{"WimpMacho","leader","wm",1},{"RakiRhodes6、","member1","rr",2},{"CeliaLaiter","member2","cl",3},{"HoppyHipman","member3","hh",4},{"PadHand","member4","ph",5}};cout<<"benevolentorderofprogrammersreport"<7、endl;cout<<"q.quit"<>temp&&temp!='q'){switch(temp)3{case'a':for(inti=0;i<5;i++){cout<
2、字母然后输出}}elseif(!isdigit(ch))//非数字非字母则原样输出cout<usingnamespacestd;intmain(){doublearr[10]={0,0,0,0,0,0,0,0,0,0};cout<<"输入10个值,当输入为非数字时结束:"<>arr[count]){count++;}doublesum=0;doubleaver=0;for(inti=0;i3、+)sum+=arr[i];aver=sum/count;intn=0;for(intj=0;javer)n++;}cout<<"输入"<usingnamespacestd;intmain(){cout<<"Pleaseenteroneoffollowingchoices:"<4、"c)carnivore"<>temp;while(temp!='c'&&temp!='p'&&temp!='t'&&temp!='g'){cout<<"Pleaseenterac,p,t,org:"<>temp;}2switch(temp){case'c':cout<<"Amapleisacarnivore"<5、anist"<usingnamespacestd;structbop{charfullname[20];chartitle[20];charbopname[20];intpreference;};intmain(){bopmember[5]={{"WimpMacho","leader","wm",1},{"RakiRhodes6、","member1","rr",2},{"CeliaLaiter","member2","cl",3},{"HoppyHipman","member3","hh",4},{"PadHand","member4","ph",5}};cout<<"benevolentorderofprogrammersreport"<7、endl;cout<<"q.quit"<>temp&&temp!='q'){switch(temp)3{case'a':for(inti=0;i<5;i++){cout<
3、+)sum+=arr[i];aver=sum/count;intn=0;for(intj=0;javer)n++;}cout<<"输入"<usingnamespacestd;intmain(){cout<<"Pleaseenteroneoffollowingchoices:"<4、"c)carnivore"<>temp;while(temp!='c'&&temp!='p'&&temp!='t'&&temp!='g'){cout<<"Pleaseenterac,p,t,org:"<>temp;}2switch(temp){case'c':cout<<"Amapleisacarnivore"<5、anist"<usingnamespacestd;structbop{charfullname[20];chartitle[20];charbopname[20];intpreference;};intmain(){bopmember[5]={{"WimpMacho","leader","wm",1},{"RakiRhodes6、","member1","rr",2},{"CeliaLaiter","member2","cl",3},{"HoppyHipman","member3","hh",4},{"PadHand","member4","ph",5}};cout<<"benevolentorderofprogrammersreport"<7、endl;cout<<"q.quit"<>temp&&temp!='q'){switch(temp)3{case'a':for(inti=0;i<5;i++){cout<
4、"c)carnivore"<>temp;while(temp!='c'&&temp!='p'&&temp!='t'&&temp!='g'){cout<<"Pleaseenterac,p,t,org:"<>temp;}2switch(temp){case'c':cout<<"Amapleisacarnivore"<5、anist"<usingnamespacestd;structbop{charfullname[20];chartitle[20];charbopname[20];intpreference;};intmain(){bopmember[5]={{"WimpMacho","leader","wm",1},{"RakiRhodes6、","member1","rr",2},{"CeliaLaiter","member2","cl",3},{"HoppyHipman","member3","hh",4},{"PadHand","member4","ph",5}};cout<<"benevolentorderofprogrammersreport"<7、endl;cout<<"q.quit"<>temp&&temp!='q'){switch(temp)3{case'a':for(inti=0;i<5;i++){cout<
5、anist"<usingnamespacestd;structbop{charfullname[20];chartitle[20];charbopname[20];intpreference;};intmain(){bopmember[5]={{"WimpMacho","leader","wm",1},{"RakiRhodes
6、","member1","rr",2},{"CeliaLaiter","member2","cl",3},{"HoppyHipman","member3","hh",4},{"PadHand","member4","ph",5}};cout<<"benevolentorderofprogrammersreport"<7、endl;cout<<"q.quit"<>temp&&temp!='q'){switch(temp)3{case'a':for(inti=0;i<5;i++){cout<
7、endl;cout<<"q.quit"<>temp&&temp!='q'){switch(temp)3{case'a':for(inti=0;i<5;i++){cout<
此文档下载收益归作者所有