cprimerplus第六版课
后编程练习答案
文件编码(008-TTIG-UTITD-GKBTT-PUUTI-WYTUI-8256)
第n”; }
二章:开始学习C++
< doubleC2F(doublet) { *t+32; } < doubleconvert(doublet) { return63240*t;n\ return0; } Entertheautomobilegasolineconsumptionfigurein Europeanstyle(litersper100kilometers): 耗油量--美国风格(mpg)转换成欧洲风格(L/100Km) #include intmain() { } n\ } rand< rand=\ usingnamespacestd; cout<<\ <<\ doubleUS_style; cin>>US_style; cout<<\ cout< return0; } < return0; snack[0].calory=200; snack[1].brand=\ snack[1].weight=; snack[1].calory=400; snack[2].brand=\ snack[2].weight=; snack[2].calory=500; for(inti=0;i<3;i++) { cout<<\ cout<<\ cout<<\ } delete[]snack; return0; } 数组—方法1 #include usingnamespacestd; constintSize=3; intsuccess[Size]; cout<<\ cin>>success[0]>>success[1]>>success[2]; cout<<\ cout<<\ cout<<\ doubleaverage=(success[0]+success[1]+success[2])/3; cout<<\ return0; } array—方法2 #include usingnamespacestd; array cout<<\ cin>>ad[0]>>ad[1]>>ad[2]; cout<<\ cout<<\ cout<<\ ad[3]=(ad[0]+ad[1]+ad[2])/3; cout<<\ return0; }