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代码;

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

  • 相关阅读:
    POJ3171 线段树优化dp
    Codeforces Round #590 (Div. 3)
    POJ2777 线段树区间染色问题
    POJ2182 Lost Cows 树状数组,二分
    P1908 逆序对 树状数组
    2019 Multi-University Training Contest 3
    主席树板子题区间第k小
    权值线段树板子题
    KMP板子题
    稀疏贝叶斯
  • 原文地址:https://www.cnblogs.com/wpqf7630/p/5463322.html
Copyright © 2011-2022 走看看