- 41
- 0
- 约1.7万字
- 约 42页
- 2019-09-19 发布于安徽
- 举报
.
.
C++ primer plus 中文版 第六版 源代码
第二章到第四章,后续继续更新………
第二章
1:#includeiostream
void main()
{
using namespace std;
int carrots;
carrots=25;
coutI have ;
coutcarrots;
coutcarrots.;
coutendl;
carrots=carrots-1;
coutCrunch,crunch.Now I have carrots carrotsendl;
}
2:#includeiostream
int stonetolb(int);
int main()
{
using namespace std;
int stone;
coutEnter the weight in stone: ;
cinstone;
int pounds=stonetolb(stone);
coutstone stone= ;
coutpounds pounds.endl;
return 0;
}
int stonetolb(int sts)
{
return 14*sts;
}
3:#includeiostream
void main()
{
using namespace std;
int carrots;
carrots=25;
coutHow many carrots do you have?endl;
cincarrots;
coutHere are two more.;
carrots=carrots+2;
coutNow you have carrots carrots.endl;
//下两行专门测试cin.get()
cin.get();
cin.get();
}
4:#includeiostream
using namespace std;
void main()
{
coutCome up and C++ me some time.;
coutendl;
coutYou wont regret it!endl;
}
5#includeiostream
void simon(int);
int main()
{
using namespace std;
simon(3);
coutPick an integer: ;
int count;
cincount;
simon(count);
coutDone !endl;
return 0;
}
void simon(int n)
{
using namespace std;
coutSimon says touch your toes n times.endl;
}
6:#includeiostream
#includecmath
void main()
{
using namespace std;
double area;
coutEnter the floor arae,in square feet,of your home: ;
cinarea;
double side;
side=sqrt(area);
coutThats the equivalent of a square side
feet to the side.endl;
coutHow fascinating!endl;
}
第三章
1:#includeiostream
#includeclimits
using namespace std;
int main()
{
int n_int=INT_MAX;
short n_short=SHRT_MAX;
long n_long=LONG_MAX;
coutint is sizeof(int) bytes.endl;
coutshort issizeof n_short bytes.endl;
coutlong issizeof n_long bytes.endlendl;
coutMaximum values :endl;
coutint :n_intendl;
coutshort :n_shortendl;
coutlong :n_longendl;
coutMinimum int value = INT_MINendl;
coutBits per byts = CHAR_BITendl;
return 0;
}
2:#includeiostream
#
您可能关注的文档
- 2017年小学教师个人工作计划总结08589.doc
- 2018届高三语文周周练1(含答案).doc
- 2018年高小学三年级政教工作日志.doc
- 2018年会计继续教育试题库.doc
- 2018新版道德及法制小学三年级上册第1单元快乐学习测试题.doc
- 2019-2020年整理中国邮政储蓄银行招聘考试真题试题库汇编.doc
- 2019年度乡村医生考试题(发乡镇).doc
- 2019年人民检察院书记员考试真题卷(含问题详解).doc
- 2019小学数学公式大全(完全版).doc
- 06089劳动关系及劳动法.doc
- 河北盐山中学等校2025-2026学年上学期高三一模化学试卷(含解析).docx
- 河北正定中学2025-2026学年高一上学期期末考试物理试卷(含解析).docx
- 河北张家口市怀安县2025-2026学年第一学期期末教学综合评价八年级地理试卷(含解析).docx
- 河南安阳市殷都区2025-2026学年第一学期期末教学质量检测七年级地理试卷(含解析).docx
- 河南安阳市滑县2025一2026学年第一学期期末学业质量监测八年级地理试题(含解析).docx
- 河南安阳市林州市2025-2026学年上学期期末考试高一政治试题(含解析).docx
- 河南焦作市武陟县第一中学2025-2026学年高一上学期1月月考语文试卷(含解析).docx
- 河南济源市2025-2026学年上学期期末学业质量调研七年级历史试卷(含解析).docx
- PICC导管并发症的紧急处理与护理.pptx
- 河南鹤壁市2025-2026学年高二上学期期末考试生物试题(含解析).docx
最近下载
- 长庆一氧化碳中毒事故案例分析.ppt VIP
- 2019创新思维考试.doc VIP
- 数学人教版九年级上册用列举法求概率.2用列举法求概率.pptx VIP
- 《工厂供电》课设计指导书.doc VIP
- 《历代名画记》与《法书要录》.docx VIP
- 心电监护常见心律失常的识别及处理医学64页PPT.pptx VIP
- (网络参考版)广西2025年高考真题历史试卷(含答案).docx VIP
- 中兴VUE-NR高级认证(52-115)练习试题.doc VIP
- 基于改进YOLOv5s算法的城市道路交通场景目标检测研究.pdf VIP
- 高中英语高考复习动词时态专项练习(共70题,附参考答案和解析).docx VIP
原创力文档

文档评论(0)