欢迎来到天天文库
浏览记录
ID:51336005
大小:60.50 KB
页数:14页
时间:2020-03-10
《CPrimerPlus第七章程序清单.doc》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、7.1calling.cpp#includevoidsimple();intmain(){usingnamespacestd;cout<<"main()willcallthesimple()function:"<2、iostream>voidcheers(int);doublecube(doublex);intmain(){usingnamespacestd;cheers(5);cout<<"Givemeanumber:";doubleside;cin>>side;doublevolume=cube(side);cout<<"A"<3、or(inti=0;iusingnamespacestd;voidn_chars(char,int);intmain(){inttimes;charch;cout<<"Enteracharacter:";cin>>ch;while(ch!='q'){cout<<"Enteraninteger:";cin>>times;n_chars(ch,times);cout<4、nteranothercharacterorpresstheq-keytoquit:";cin>>ch;}cout<<"Thevalueoftimesis"<0)cout<longdoubleprobability(unsignednumbers,unsignedpicks);intmain(){usingnamespacestd;doubletotal5、,choices;cout<<"Enterthetotalnumberofchoicesonthegamecard"<>total>>choices)&&choices<=total){cout<<"Youhaveonechancein";cout<6、eturn0;}longdoubleprobability(unsignednumbers,unsignedpicks){longdoubleresult=1.0;longdoublen;unsignedp;for(n=numbers,p=picks;p>0;n--,p--)result=result*n/p;returnresult;}7.5arrfun1.cpp#includeconstintArSize=8;intsum_arr(intarr[],intn);intmain(){usingnamespacestd;intcookies[Ar7、Size]={1,2,4,8,16,64,128};intsum=sum_arr(cookies,ArSize);cout<<"Totalcookieseaten:"<constintArSize=8;intsum_arr(intarr[],intn);usingnamespacestd
2、iostream>voidcheers(int);doublecube(doublex);intmain(){usingnamespacestd;cheers(5);cout<<"Givemeanumber:";doubleside;cin>>side;doublevolume=cube(side);cout<<"A"<3、or(inti=0;iusingnamespacestd;voidn_chars(char,int);intmain(){inttimes;charch;cout<<"Enteracharacter:";cin>>ch;while(ch!='q'){cout<<"Enteraninteger:";cin>>times;n_chars(ch,times);cout<4、nteranothercharacterorpresstheq-keytoquit:";cin>>ch;}cout<<"Thevalueoftimesis"<0)cout<longdoubleprobability(unsignednumbers,unsignedpicks);intmain(){usingnamespacestd;doubletotal5、,choices;cout<<"Enterthetotalnumberofchoicesonthegamecard"<>total>>choices)&&choices<=total){cout<<"Youhaveonechancein";cout<6、eturn0;}longdoubleprobability(unsignednumbers,unsignedpicks){longdoubleresult=1.0;longdoublen;unsignedp;for(n=numbers,p=picks;p>0;n--,p--)result=result*n/p;returnresult;}7.5arrfun1.cpp#includeconstintArSize=8;intsum_arr(intarr[],intn);intmain(){usingnamespacestd;intcookies[Ar7、Size]={1,2,4,8,16,64,128};intsum=sum_arr(cookies,ArSize);cout<<"Totalcookieseaten:"<constintArSize=8;intsum_arr(intarr[],intn);usingnamespacestd
3、or(inti=0;iusingnamespacestd;voidn_chars(char,int);intmain(){inttimes;charch;cout<<"Enteracharacter:";cin>>ch;while(ch!='q'){cout<<"Enteraninteger:";cin>>times;n_chars(ch,times);cout<4、nteranothercharacterorpresstheq-keytoquit:";cin>>ch;}cout<<"Thevalueoftimesis"<0)cout<longdoubleprobability(unsignednumbers,unsignedpicks);intmain(){usingnamespacestd;doubletotal5、,choices;cout<<"Enterthetotalnumberofchoicesonthegamecard"<>total>>choices)&&choices<=total){cout<<"Youhaveonechancein";cout<6、eturn0;}longdoubleprobability(unsignednumbers,unsignedpicks){longdoubleresult=1.0;longdoublen;unsignedp;for(n=numbers,p=picks;p>0;n--,p--)result=result*n/p;returnresult;}7.5arrfun1.cpp#includeconstintArSize=8;intsum_arr(intarr[],intn);intmain(){usingnamespacestd;intcookies[Ar7、Size]={1,2,4,8,16,64,128};intsum=sum_arr(cookies,ArSize);cout<<"Totalcookieseaten:"<constintArSize=8;intsum_arr(intarr[],intn);usingnamespacestd
4、nteranothercharacterorpresstheq-keytoquit:";cin>>ch;}cout<<"Thevalueoftimesis"<0)cout<longdoubleprobability(unsignednumbers,unsignedpicks);intmain(){usingnamespacestd;doubletotal
5、,choices;cout<<"Enterthetotalnumberofchoicesonthegamecard"<>total>>choices)&&choices<=total){cout<<"Youhaveonechancein";cout<6、eturn0;}longdoubleprobability(unsignednumbers,unsignedpicks){longdoubleresult=1.0;longdoublen;unsignedp;for(n=numbers,p=picks;p>0;n--,p--)result=result*n/p;returnresult;}7.5arrfun1.cpp#includeconstintArSize=8;intsum_arr(intarr[],intn);intmain(){usingnamespacestd;intcookies[Ar7、Size]={1,2,4,8,16,64,128};intsum=sum_arr(cookies,ArSize);cout<<"Totalcookieseaten:"<constintArSize=8;intsum_arr(intarr[],intn);usingnamespacestd
6、eturn0;}longdoubleprobability(unsignednumbers,unsignedpicks){longdoubleresult=1.0;longdoublen;unsignedp;for(n=numbers,p=picks;p>0;n--,p--)result=result*n/p;returnresult;}7.5arrfun1.cpp#includeconstintArSize=8;intsum_arr(intarr[],intn);intmain(){usingnamespacestd;intcookies[Ar
7、Size]={1,2,4,8,16,64,128};intsum=sum_arr(cookies,ArSize);cout<<"Totalcookieseaten:"<constintArSize=8;intsum_arr(intarr[],intn);usingnamespacestd
此文档下载收益归作者所有