C++ Primer Plus 第6版 编程题参考答案(1)
来源:互联网 发布:手机电影网php源码 编辑:程序博客网 时间:2024/05/19 19:12
事先声明,博客中的全部程序由博主自行编写,全部在Code Blocks 16.01下编译通过,部分程序使用了C++11标准。绝非标准答案,仅供参考!
第二章
2.1
#include<iostream>int main(){ using namespace std; cout<<"K"; cout<<"\n"; cout<<"Address? Fuck you!!!"; return 0;}
#include<iostream>int transforming(int);int main(){ using namespace std; int longlong; cout<<"Please enter long:\n"; cin >> longlong; int yard=transforming(longlong); cout<<"The yard is "<<yard; return 0;}int transforming(int longlong){ int yard; yard=220*longlong; return yard;}
2.3
#include<iostream>void three();void see();int main(){ three(); three(); see(); see(); return 0;}void three(){ using namespace std; cout<<"Three blind mice\n";}void see(){ using namespace std; cout<<"See how they run\n";}
2.4
#include<iostream>int enter();int month(int);int main(){ using namespace std; int age=enter(); int month1=month(age); cout<<"Month is "<<month1;}int enter(){ using namespace std; cout<<"Enter your age:"; int age1; cin>>age1; cout<<"\n"; return age1;}int month(int age){ int month; month=age*12; return month;}
2.5
#include<iostream>int transforming(int);int main(){ using namespace std; cout<<"Please enter a Celsius value: "; int celsius; cin>>celsius; int fah; fah=transforming(celsius); cout<<celsius<<" degress Celsius is "<<fah<<" degress Fahrenheit"; return 0;}int transforming(int celsius){ int fah=1.8*celsius+32; return fah;}
2.6
#include<iostream>double transforming(double);int main(){ using namespace std; cout<<"Enter the number of light years: "; double lightyears; cin>>lightyears; double unit; unit=transforming(lightyears); cout<<lightyears<<" light years = "<<unit<<" astronomical units";}double transforming(double lightyears){ double unit=63240*lightyears; return unit;}
#include<iostream>void display(int,int);int main(){ using namespace std; int hour; int minute; cout<<"Enter the number of hours:"; cin>>hour; cout<<"Enter the number of minutes:"; cin>>minute; display(hour,minute); return 0;}void display(int hour,int minute){ using namespace std; cout<<"Time: "<<hour<<":"<<minute;}
阅读全文
0 0
- C++ Primer Plus 第6版 编程题参考答案(1)
- C Primer Plus 第五版11.13编程题参考答案
- 《C Primer Plus(第5版)中文版》第6章编程练习第1题
- 《C Primer Plus(第5版)中文版》第6章编程练习第14题
- 《C Primer Plus(第5版)中文版》第6章编程练习第15题
- 《C Primer Plus(第5版)中文版》第6章编程练习第16题
- 《C Primer Plus(第5版)中文版》第7章编程练习第6题
- 《C Primer Plus(第5版)中文版》第7章编程练习第1题
- C++Primer Plus第6版 4.13编程练习答案
- 《C Primer Plus(第5版)中文版》第7章编程练习第2题
- 《C Primer Plus(第5版)中文版》第7章编程练习第3题
- 《C Primer Plus(第5版)中文版》第7章编程练习第4题
- 《C Primer Plus(第5版)中文版》第7章编程练习第5题
- 《C Primer Plus(第5版)中文版》第7章编程练习第7题
- 《C Primer Plus(第5版)中文版》第7章编程练习第8题
- 《C Primer Plus(第5版)中文版》第7章编程练习第9题
- 《C Primer Plus(第5版)中文版》第7章编程练习第10题
- 《C Primer Plus(第5版)中文版》第7章编程练习第11题
- hibernate随笔(知识盲点)
- 颠覆平庸:在技术上持续精进
- Java对List中的中文属性按照拼音排序
- 【JS】关键词 in
- lintcode--平衡二叉树
- C++ Primer Plus 第6版 编程题参考答案(1)
- 【CodeForces
- in typeof instanceof ===这些运算符有什么作用
- JAVA集合类(大公司面试喜欢问的)
- React Native 生命周期
- hdu 6129 Just do it (杨辉三角)
- BZOJ——1452
- SharePreferences源码分析(commit与apply的区别以及原理)
- java测试FTP服务器的上传、下载、删除文件