欢迎来到天天文库
浏览记录
ID:51489593
大小:63.58 KB
页数:7页
时间:2020-03-25
《C++Primer Plus(第6版)中文版编程练习答案--第五章.pdf》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、注释:这些程序是唐刀在学习的时候编写的,其中可能存在错误和不足,大家做个参考就好。1.#includeintmain(){usingnamespacestd;intnum_big;intnum_small;cout<<"pleaseinputthesmallnumber:"<>num_small;cout<<"pleaseinputthebignumber:"<>num_big;inttotal=0;for(inti=num_small;i<=nu
2、m_big;i++){total+=i;}cout<<"totalis"<#includeusingnamespacestd;intmain(){arrayarr;arr[1]=arr[0]=1LD;for(inti=2;i<=100;i++)arr[i]=i*arr[i-1];for(inti=2;i<=100;i++)cout<3、dl;return0;}13.#includeusingnamespacestd;intmain(){doublenum=0;doubletotal=0;cout<<"inputthenumber:"<>num;while(num!=0){total+=num;cout<<"inputthenumberagain:"<>num;}cout<<"gameover!"<4、al<usingnamespacestd;intmain(){doubled_value=0;doublec_value=0;intyear;d_value=100+100*0.1;c_value=100+100*0.05;for(inti=2;d_value>=c_value;i++){d_value=d_value+100*0.1;c_value=c_value*1.05;year=i;}cout<<"after"<5、ears,Cleo'smoneywillmuchthanDaphne!"<#includeusingnamespacestd;intmain(){/*char*month[12]={"January","February","March","April","May","June","July","August","September","October","November","December"};intnum[12]6、;for(inti=0;i<12;i++){cout<<"pleaseinputthenumberofbooksin"<>num[i];}inttotal=0;for(inti=0;i<12;i++){total+=num[i];}cout<<"thetotalofbooksis"<7、,"August","September","October","November","December"};intnum[12];for(inti=0;i<12;i++){cout<<"pleaseinputthenumberofbooksin"<>num[i];}inttotal=0;for(inti=0;i<12;i++){total+=num[i];}3cout<<"thetotalofbooksis"<8、.#include#includeusingnamespacestd;intmain(){stringmonth[12]={"January","February","March","April","May","June","July","August","September","October","November","December"};intnum[3][12];for
3、dl;return0;}13.#includeusingnamespacestd;intmain(){doublenum=0;doubletotal=0;cout<<"inputthenumber:"<>num;while(num!=0){total+=num;cout<<"inputthenumberagain:"<>num;}cout<<"gameover!"<4、al<usingnamespacestd;intmain(){doubled_value=0;doublec_value=0;intyear;d_value=100+100*0.1;c_value=100+100*0.05;for(inti=2;d_value>=c_value;i++){d_value=d_value+100*0.1;c_value=c_value*1.05;year=i;}cout<<"after"<5、ears,Cleo'smoneywillmuchthanDaphne!"<#includeusingnamespacestd;intmain(){/*char*month[12]={"January","February","March","April","May","June","July","August","September","October","November","December"};intnum[12]6、;for(inti=0;i<12;i++){cout<<"pleaseinputthenumberofbooksin"<>num[i];}inttotal=0;for(inti=0;i<12;i++){total+=num[i];}cout<<"thetotalofbooksis"<7、,"August","September","October","November","December"};intnum[12];for(inti=0;i<12;i++){cout<<"pleaseinputthenumberofbooksin"<>num[i];}inttotal=0;for(inti=0;i<12;i++){total+=num[i];}3cout<<"thetotalofbooksis"<8、.#include#includeusingnamespacestd;intmain(){stringmonth[12]={"January","February","March","April","May","June","July","August","September","October","November","December"};intnum[3][12];for
4、al<usingnamespacestd;intmain(){doubled_value=0;doublec_value=0;intyear;d_value=100+100*0.1;c_value=100+100*0.05;for(inti=2;d_value>=c_value;i++){d_value=d_value+100*0.1;c_value=c_value*1.05;year=i;}cout<<"after"<5、ears,Cleo'smoneywillmuchthanDaphne!"<#includeusingnamespacestd;intmain(){/*char*month[12]={"January","February","March","April","May","June","July","August","September","October","November","December"};intnum[12]6、;for(inti=0;i<12;i++){cout<<"pleaseinputthenumberofbooksin"<>num[i];}inttotal=0;for(inti=0;i<12;i++){total+=num[i];}cout<<"thetotalofbooksis"<7、,"August","September","October","November","December"};intnum[12];for(inti=0;i<12;i++){cout<<"pleaseinputthenumberofbooksin"<>num[i];}inttotal=0;for(inti=0;i<12;i++){total+=num[i];}3cout<<"thetotalofbooksis"<8、.#include#includeusingnamespacestd;intmain(){stringmonth[12]={"January","February","March","April","May","June","July","August","September","October","November","December"};intnum[3][12];for
5、ears,Cleo'smoneywillmuchthanDaphne!"<#includeusingnamespacestd;intmain(){/*char*month[12]={"January","February","March","April","May","June","July","August","September","October","November","December"};intnum[12]
6、;for(inti=0;i<12;i++){cout<<"pleaseinputthenumberofbooksin"<>num[i];}inttotal=0;for(inti=0;i<12;i++){total+=num[i];}cout<<"thetotalofbooksis"<7、,"August","September","October","November","December"};intnum[12];for(inti=0;i<12;i++){cout<<"pleaseinputthenumberofbooksin"<>num[i];}inttotal=0;for(inti=0;i<12;i++){total+=num[i];}3cout<<"thetotalofbooksis"<8、.#include#includeusingnamespacestd;intmain(){stringmonth[12]={"January","February","March","April","May","June","July","August","September","October","November","December"};intnum[3][12];for
7、,"August","September","October","November","December"};intnum[12];for(inti=0;i<12;i++){cout<<"pleaseinputthenumberofbooksin"<>num[i];}inttotal=0;for(inti=0;i<12;i++){total+=num[i];}3cout<<"thetotalofbooksis"<8、.#include#includeusingnamespacestd;intmain(){stringmonth[12]={"January","February","March","April","May","June","July","August","September","October","November","December"};intnum[3][12];for
8、.#include#includeusingnamespacestd;intmain(){stringmonth[12]={"January","February","March","April","May","June","July","August","September","October","November","December"};intnum[3][12];for
此文档下载收益归作者所有