zoukankan      html  css  js  c++  java
  • c++ primer plus 第二章 课后题答案

    #include<iostream>
    
    using namespace std;
    
    int main()
    {
        cout << "My name is Jiantong Chen." << endl << "I'm a student in the Xi'an University.";
        cin.get();
        return 0;
    }

    #include<iostream>
    using namespace std;
    
    int main()
    {
        int a;
        cout << "Please enter a number of the long:";
        cin >> a;
        cout << endl << "The ma of it is:" << (a*220);
        cin.get();
        cin.get();
        return 0;
    }

    #include<iostream>
    void print_1(void);
    void print_2(void);
    
    using namespace std;
    
    int main()
    {
        print_1();
        print_1();
        print_2();
        print_2();
        cin.get();
        return 0;
    }
    
    void print_1(void)
    {
        cout << "Three blind mice" << endl;
    }
    
    void print_2(void)
    {
        cout << "See how they run" << endl;
    }

    #include<iostream>
    
    using namespace std;
    
    int main()
    {
        int age;
        cout << "Enter you age:";
        cin >> age;
        cout << endl << "This age contains " << (age*12) << " months.";
        cin.get();
        cin.get();
        return 0;
    }

     

    #include<iostream>
    using namespace std;
    double convert(double);
    
    int main()
    {
        int Celsius;
        double Fahrenheit;
        cout << "Please enter a Celsius value: ";
        cin >> Celsius;
        Fahrenheit = convert(Celsius);
        cout << endl << Celsius << " degrees Celsius is " << Fahrenheit << " degrees Fahrenheit.";
        cin.get();
        cin.get();
        return 0;
    }
    
    double convert(double Celsius)
    {
        double Fahrenheit;
        Fahrenheit = 1.8*Celsius + 32.0;
        return Fahrenheit;
    }

    #include<iostream>
    using namespace std;
    double convert(double);
    
    int main()
    {
        double in_put;
        double out_put;
        cout << "Enter the number of light years: ";
        cin >> in_put;
        out_put = convert(in_put);
        cout << endl << in_put << " light years = " << out_put << " astronomical units.";
        cin.get();
        cin.get();
        return 0;
    }
    
    double convert(double in_put)
    {
        double out_put;
        out_put = in_put * 63240;
        return out_put;
    }

     

    #include<iostream>
    using namespace std;
    void display(int, int);
    
    int main()
    {
        int hours;
        int minutes;
    
        cout << "Enter the number of hours : ";
        cin >> hours;
        cout << "Enter the number of minutes : ";
        cin >> minutes;
    
        display(hours, minutes);
        cin.get();
        cin.get();
        return 0;
    }
    
    void display(int a,int b)
    {
        cout << "Time: " << a << ":" << b;
    }
  • 相关阅读:
    fastjson基本使用 (待继续完善)【原】
    webkit内核浏览器的CSS写法
    sencha touch pull-refresh-panel 面板下拉刷新
    一个非常棒的星星评分插件
    JavaScript字符转Unicode,顺便说句:GitHub的Oh no页面很亮
    Git版本控制软件结合GitHub从入门到精通常用命令学习手册
    手把手教你如何加入到github的开源世界!
    前端面试题:高效地随机选取数组中的元素
    CSS3 动画animation
    CSS3 Transform
  • 原文地址:https://www.cnblogs.com/CJT-blog/p/10230324.html
Copyright © 2011-2022 走看看