欢迎来到天天文库
浏览记录
ID:51489578
大小:62.75 KB
页数:7页
时间:2020-03-25
《C++Primer Plus(第6版)中文版编程练习答案--第四章.pdf》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、注释:这些程序是唐刀在学习的时候编写的,其中可能存在错误和不足,大家做个参考就好。1.#include#include#includeusingnamespacestd;voidmain(){stringfirst_name;stringlast_name;cout<<"what'syourfirstname?";getline(cin,first_name);cout<<"what'syourlastname?";getline(cin,last_name);chargrade;
2、cout<<"whatlettergradedoyoudeserve?";cin>>grade;intage;cout<<"whatisyourage?";cin>>age;cout<<"name:"<#include#includeusingnamespacestd;voi
3、dmain(){stringname;stringdessert;1cout<<"enteryourname:"<#include#includeusingnamespace
4、std;voidmain(){charfirst_name[20];charlast_name[20];cout<<"enteryourfirstname:"<5、nclude#include#includeusingnamespacestd;voidmain(){stringfirst_name;stringlast_name;cout<<"enteryourfirstname:"<6、<#include#includeusingnamespacestd;voidmain(){structCandyBar{charname[20];doubleweight;intcalary;};CandyBarsnack={"MochaMunch",2.3,350};cout<<"name:"<7、ndl;cout<<"calary:"<usingnamespacestd;voidmain(){structCandyBar{charname[20];doubleweight;intcalary;};3CandyBarsnack[3]={{"MochaMunch",2.3,350},{"BluceLian",2.5,555},{"JimGreen",3.5,79}};for(inti=0;i<3;i++){cout<<"Thisisthe"<8、<<"person"<
5、nclude#include#includeusingnamespacestd;voidmain(){stringfirst_name;stringlast_name;cout<<"enteryourfirstname:"<6、<#include#includeusingnamespacestd;voidmain(){structCandyBar{charname[20];doubleweight;intcalary;};CandyBarsnack={"MochaMunch",2.3,350};cout<<"name:"<7、ndl;cout<<"calary:"<usingnamespacestd;voidmain(){structCandyBar{charname[20];doubleweight;intcalary;};3CandyBarsnack[3]={{"MochaMunch",2.3,350},{"BluceLian",2.5,555},{"JimGreen",3.5,79}};for(inti=0;i<3;i++){cout<<"Thisisthe"<8、<<"person"<
6、<#include#includeusingnamespacestd;voidmain(){structCandyBar{charname[20];doubleweight;intcalary;};CandyBarsnack={"MochaMunch",2.3,350};cout<<"name:"<7、ndl;cout<<"calary:"<usingnamespacestd;voidmain(){structCandyBar{charname[20];doubleweight;intcalary;};3CandyBarsnack[3]={{"MochaMunch",2.3,350},{"BluceLian",2.5,555},{"JimGreen",3.5,79}};for(inti=0;i<3;i++){cout<<"Thisisthe"<8、<<"person"<
7、ndl;cout<<"calary:"<usingnamespacestd;voidmain(){structCandyBar{charname[20];doubleweight;intcalary;};3CandyBarsnack[3]={{"MochaMunch",2.3,350},{"BluceLian",2.5,555},{"JimGreen",3.5,79}};for(inti=0;i<3;i++){cout<<"Thisisthe"<8、<<"person"<
8、<<"person"<
此文档下载收益归作者所有