zoukankan      html  css  js  c++  java
  • object-oriented first work

    前言:在星期三的第一次面向对象程序设计课,遇见我们的栋哥,初次见面,发现老师的幽默.....下课后,就给我们一道作业题目。。。

    作业要求:Create a program that asks for the radius of a circle and prints the area of that circle, using cin and cout. The whole program

    should be divided into two source files (.cpp).Hand in the source files and the head files which you create.

    翻译过来就是:创建一个程序,给出球的半径并打印该圆的面积使用 cin 与 cout。整个程序应分为两个源代码文件 (.cpp)。手中的源文件和头文件你的创造。
    (ps:这是百度的翻译)

    然后我去做了一个.h文件(用来存放函数)和一个.cpp(来输入半径R的)

    
    >.cpp
    
    
    
    #include<iostream>
    #include"print.h" 
    
    
    using namespace std;
    int main()
    {
        double r;
        r=input();
        Pr(r);
        return 0;
    }
    
    
    >.h
    
    
    
    
    #include<iostream>
    #define pi 3.1415926
    
    
    using namespace std;
    
    double input()
    {
    	double R;
    	cout << "Please input the value of the radius of the circle: ";
    	cin >> R ;
    	return R;
    }
     
    void Pr(double r)
    {
        cout << pi*r*r << endl;
    } 
    
    

    此处是传到github代码;

    最后还是那句话,好好学,认真学,努力学。加油!!!

  • 相关阅读:
    python
    python
    python
    python
    python
    python-接口自动化 token 的处理
    如何顺利度过试用期?
    印象深刻-bug汇总
    go 实现1000以内的数字,输入35 输出三十五
    jenkins 汉化
  • 原文地址:https://www.cnblogs.com/wpqf7630/p/5463322.html
Copyright © 2011-2022 走看看