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

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

  • 相关阅读:
    第01组 Beta版本演示
    2019 SDN上机第7次作业
    第01组 Beta冲刺(4/4)
    系统综合实践第6次作业
    系统综合实践第5次作业
    系统综合实践第4次作业
    系统综合实践第3次作业
    系统综合实践第2次作业
    系统综合实践第1次作业
    软工实践个人总结
  • 原文地址:https://www.cnblogs.com/wpqf7630/p/5463322.html
Copyright © 2011-2022 走看看