C++ Primer第二章课后编程题
来源:互联网 发布:淘宝店卖什么好 编辑:程序博客网 时间:2024/05/14 02:07
1、
代码:
#include<iostream>int main(){ using namespace std; cout << "My name : guugle" << endl; cout << "My address : China Shenzhen" << endl; return 0;}
运行结果:
2、
代码:
#include<iostream>int main(){ using namespace std; cout << "请输入尺寸:"; int lang; cin >> lang; lang = 220 * lang; cout << "转换成码为:" << lang <<endl; return 0;}
运行结果:
3、
代码:
#include<iostream>using namespace std;void functionA();void functionB();int main(){ functionA(); functionA(); functionB(); functionB(); return 0;}void functionA(){ cout << "Three blind misc"; cout << endl;}void functionB(){ cout << "See how they Run"; cout << endl;}
运行结果:
4、
代码:
#include<iostream>using namespace std;void hua(int);int main(){ cout << "Please enter a Celsius value:"; int wendu; cin >> wendu; hua(wendu); return 0;}void hua(int wendu){ double huadu = 1.8 * wendu + 32.0; cout << wendu << "degrees Velsius is " << huadu << "degrees Fahrenheit" << endl;}
运行结果:
5、
代码:
#include<iostream>using namespace std;double lightyear(double);int main(){ cout << "Enter the number of light years:"; double years; cin >> years; double lyear = lightyear(years); cout << years <<"light years = " << lyear << "astronomical units."; cout << endl; return 0;}double lightyear(double years){ return years * 63240;}
运行结果:
6、
代码:
#include<iostream>using namespace std;void showTime(int, int);int main(){ cout << "请输入小时:"; int hours; cin >> hours; cout << "请输入分钟数:"; int minutes; cin >> minutes; showTime(hours, minutes); return 0;}void showTime(int hours, int minutes){ cout << "Time:" << hours <<":" << minutes << endl;}
运行结果:
0 0
- C++ Primer第二章课后编程题
- c++primer第十章课后编程题
- Primer Plus 12章课后编程练习 第二题
- 《C Primer Plus》第二章 C语言概述 课后习题
- 【C Primer Plus】【课后习题】第二章C语言概述
- C++ Primer Plus第二章课后编程答案
- C++ Primer Plus 第二章课后编程练习
- c++Primer学习笔记之七:第二章课后习题
- C++Primer 中文版 第五版 第二章课后习题答案
- C++ Primer第三章课后编程题
- C++ Primer第四章课后编程题
- C++ Primer第五章课后编程题
- C++ Primer第七章课后编程题
- C++ Primer第八章课后编程题
- C++ Primer第九章课后编程题
- C++primer plus第六版课后编程题答案 6.1
- C++primer plus第六版课后编程题答案 6.2
- C++primer plus第六版课后编程题答案 6.3
- 完美解决mysql下utf-8的乱码问题
- 5.4.3.1 C# 3.0 中的类型推断
- 护理专业就业前景调查
- 文件夹的菜单栏和地址栏不见了
- TabActivity 的onkeydown失效问题
- C++ Primer第二章课后编程题
- tcp三次握手
- 原创文章
- UITabBarController
- 数组排序NSSortDescriptor
- Struts2从后台传递数据到前台的主要方法和流程
- Java中comparable和comparator接口的比较
- SVN的安装和更新
- Project Euler - 3