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

作业要求: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代码;

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

object-oriented first work的更多相关文章

  1. CSharpGL - Object Oriented OpenGL in C#

    Object Oriented OpenGL in C#

  2. Object Oriented Programming python

    Object Oriented Programming python new concepts of the object oriented programming : class encapsula ...

  3. What is Object Oriented Design? (OOD)

    Object Oriented Design is the concept that forces programmers to plan out their code in order to hav ...

  4. Java - 面向对象(object oriented)计划 详细解释

    面向对象(object oriented)计划 详细解释 本文地址: http://blog.csdn.net/caroline_wendy/article/details/24058107 程序包括 ...

  5. OO开发思想:面向对象的开发方法(Object oriented,OO)

    面向对象的开发方法(Object oriented,OO)认为是好文章吧,拿来分享一下(转载) 面向对象的开发方法(Object oriented,OO) 从事软件开发的工程 师们常常有这样 的体会: ...

  6. JavaScript: Constructor and Object Oriented Programming

    Constructor :  Grammar: object.constructor Example: Javascript code: 1 function obj1() { this.number ...

  7. 面对对象编程(OOP, Object Oriented Programming)及其三个基本特性

    一千个读者,一千个哈姆雷特.对于面对对象编程,书上都会告诉我们它有三个基本特性,封装,继承,多态,但谈起对这三点的见解,又是仁者见仁智者见智,感觉还是得多去编程中体验把 . 面向对象编程(OOP, O ...

  8. Python学习札记(三十) 面向对象编程 Object Oriented Program 1

    参考:OOP NOTE 1.面向对象编程--Object Oriented Programming,简称OOP,是一种程序设计思想.OOP把对象作为程序的基本单元,一个对象包含了数据和操作数据的函数. ...

  9. 使用一个数组存储一个英文句子"java is an object oriented programing language"

    class fun { public static void main(String[] args) { String str="java is an object oriented pro ...

  10. 《Using Databases with Python》Week1 Object Oriented Python 课堂笔记

    Coursera课程<Using Databases with Python> 密歇根大学 Charles Severance Week1 Object Oriented Python U ...

随机推荐

  1. WPF : ListBox的几种Template属性

    原文:WPF : ListBox的几种Template属性 属性名 属性的类名 功能 示例 Template ControlTemplate 定义控件自身的外观.其子元素的布局可以自定义,也可以由It ...

  2. 【python3】将视频转换为代码视频

    一.环境准备 1.需要安装opencv,直接安装 pip install opencv-python 2.需要安装ffmpeg ,直接解压免安装,下载传送门: 将 ffmpeg.exe 的路径复制,替 ...

  3. RTTI(运行时类型识别)

    C++为了能够在运行时正确判断一个对象确切的类型,加入了RTTI和type_info. type_info 为每一个类型增加一个type_info对象. 为了能够在运行时获得对象的类型信息type_i ...

  4. 【LG3721】[HNOI2017]单旋

    [LG3721][HNOI2017]单旋 题面 洛谷 题解 20pts 直接模拟\(spaly\)的过程即可. 100pts 可以发现单旋最大.最小值到根,手玩是有显然规律的,发现只需要几次\(lin ...

  5. CF 1110 D. Jongmah

    D. Jongmah 链接 题意: 一些数字,有两种方式组成一个三元组,[x,x,x],[x,x+1,x+2],每个数字只能用一次,求最多组成多少三元组. 分析: 因为每三个[x,x+1,x+2]是可 ...

  6. cogs1889 [SDOI2008]Cave 洞穴勘测 link-cut tree

    link-cut tree // It is made by XZZ #include<cstdio> #include<algorithm> #define il inlin ...

  7. django套用模板404报错小结

    首先,我的项目名是MyProject.每次当我运行,然后测试页面的时候,总是弹出 其实根据stackoverflow上某大佬的解释大意就是在setting.py和urls.py的匹配上出了问题 此处放 ...

  8. 利用Smith圆图设计匹配网络

    要实现射频最大的功率传输,必须使负载阻抗与源阻抗相匹配(即信号源阻抗与负载阻抗共轭相等),实现匹配的通常做法是在源和负载之间插入一个匹配网络,该网络不仅仅为减少功率损耗而设计,还可减少噪声干扰.提高功 ...

  9. python爬虫beautifulsoup4系列2

    前言 本篇详细介绍beautifulsoup4的功能,从最基础的开始讲起,让小伙伴们都能入门 一.读取HTML页面 1.先写一个简单的html页面,把以下内容copy出来,保存为html格式文件 &l ...

  10. 【Unity Shader】(十) ------ UV动画原理及简易实现

    笔者使用的是 Unity 2018.2.0f2 + VS2017,建议读者使用与 Unity 2018 相近的版本,避免一些因为版本不一致而出现的问题. [Unity Shader](三) ----- ...