博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
C Primer plus 第六版 第二章课后习题答案
阅读量:2052 次
发布时间:2019-04-28

本文共 2183 字,大约阅读时间需要 7 分钟。

C Primer plus 第六版 第二章课后习题答案

第一题
#include 
using std::cout;using std::endl;int main() {
cout << "BeanGuohui" << endl; cout << "成都" << endl; getchar();}
第二题
#include 
#include
using std::cin;using std::cout;using std::endl;int main() {
cout << "请输入一个以long为单位的距离:"; double distance; cin >> distance; cout << distance << " long = " << distance * 220 << " 码" << endl; system("pause");}
第三题
#include 
#include
using std::cout;using std::cin;using std::endl;void FirstPrint(){
cout << "Three blind mice" << endl;}void SecondPrint() {
cout << "See how they run" << endl;}int main() {
FirstPrint(); FirstPrint(); SecondPrint(); SecondPrint(); system("pause");}
第四题
#include 
#include
using std::cout;using std::cin;using std::endl;int main() {
cout << "Enter your age: "; int age = 0; cin >> age; cout << "该年龄包含" << age * 12 << "个月!" << endl; system("pause");}
第五题
#include 
#include
using std::cout;using std::cin;using std::endl;double ChangeTemperature(double CentigradeTemperature) {
return 1.8 * CentigradeTemperature + 32.0;}int main() {
double CentigradeTemperature = 0; cout << "Please enter a Celsius value: "; cin >> CentigradeTemperature; cout << CentigradeTemperature << " degrees Celeius is " << ChangeTemperature(CentigradeTemperature) << " degrees Fahrenheit." << endl; system("pause");}
第六题
#include 
#include
using std::cout;using std::cin;using std::endl;double changeLightYear(double lightYear) {
return 63240 * lightYear;}int main() {
double lightYear = 0; cout << "Enter the number of light years: "; cin >> lightYear; cout << lightYear << " light year = " << changeLightYear(lightYear) << " astronomical units." << endl; system("pause");}
第七题
#include 
#include
using std::cout;using std::cin;using std::endl;void showData(int hour, int minute) {
cout << "Time: " << hour << ":" << minute << endl;}int main() {
int hour = 0, minute = 0; cout << "Enter the number of hours: "; cin >> hour; cout << "Enter the number of minutes: "; cin >> minute; showData(hour, minute); system("pause");}

转载地址:http://gkylf.baihongyu.com/

你可能感兴趣的文章
PAT1090 Highest Price in Supply Chain 树DFS
查看>>
(PAT 1096) Consecutive Factors (质因子分解)
查看>>
(PAT 1019) General Palindromic Number (进制转换)
查看>>
(PAT 1073) Scientific Notation (字符串模拟题)
查看>>
(PAT 1080) Graduate Admission (排序)
查看>>
Play on Words UVA - 10129 (欧拉路径)
查看>>
mininet+floodlight搭建sdn环境并创建简答topo
查看>>
【UML】《Theach yourself uml in 24hours》——hour2&hour3
查看>>
【linux】nohup和&的作用
查看>>
【UML】《Theach yourself uml in 24hours》——hour4
查看>>
Set、WeakSet、Map以及WeakMap结构基本知识点
查看>>
【NLP学习笔记】(一)Gensim基本使用方法
查看>>
【NLP学习笔记】(二)gensim使用之Topics and Transformations
查看>>
【深度学习】LSTM的架构及公式
查看>>
【深度学习】GRU的结构图及公式
查看>>
【python】re模块常用方法
查看>>
剑指offer 19.二叉树的镜像
查看>>
剑指offer 20.顺时针打印矩阵
查看>>
剑指offer 21.包含min函数的栈
查看>>
剑指offer 23.从上往下打印二叉树
查看>>