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代码;
最后还是那句话,好好学,认真学,努力学。加油!!!
object-oriented first work的更多相关文章
- CSharpGL - Object Oriented OpenGL in C#
Object Oriented OpenGL in C#
- Object Oriented Programming python
Object Oriented Programming python new concepts of the object oriented programming : class encapsula ...
- What is Object Oriented Design? (OOD)
Object Oriented Design is the concept that forces programmers to plan out their code in order to hav ...
- Java - 面向对象(object oriented)计划 详细解释
面向对象(object oriented)计划 详细解释 本文地址: http://blog.csdn.net/caroline_wendy/article/details/24058107 程序包括 ...
- OO开发思想:面向对象的开发方法(Object oriented,OO)
面向对象的开发方法(Object oriented,OO)认为是好文章吧,拿来分享一下(转载) 面向对象的开发方法(Object oriented,OO) 从事软件开发的工程 师们常常有这样 的体会: ...
- JavaScript: Constructor and Object Oriented Programming
Constructor : Grammar: object.constructor Example: Javascript code: 1 function obj1() { this.number ...
- 面对对象编程(OOP, Object Oriented Programming)及其三个基本特性
一千个读者,一千个哈姆雷特.对于面对对象编程,书上都会告诉我们它有三个基本特性,封装,继承,多态,但谈起对这三点的见解,又是仁者见仁智者见智,感觉还是得多去编程中体验把 . 面向对象编程(OOP, O ...
- Python学习札记(三十) 面向对象编程 Object Oriented Program 1
参考:OOP NOTE 1.面向对象编程--Object Oriented Programming,简称OOP,是一种程序设计思想.OOP把对象作为程序的基本单元,一个对象包含了数据和操作数据的函数. ...
- 使用一个数组存储一个英文句子"java is an object oriented programing language"
class fun { public static void main(String[] args) { String str="java is an object oriented pro ...
- 《Using Databases with Python》Week1 Object Oriented Python 课堂笔记
Coursera课程<Using Databases with Python> 密歇根大学 Charles Severance Week1 Object Oriented Python U ...
随机推荐
- 成为linux的合格公民
前言: 该片文章献给申请linux国籍的所有瘾君子们: 还记得17年的勒索病毒感染了无数的window操作系统. 在windows上待久的公民会渴望有无另一个世界,简单的图形化操作使得一切都变的 ...
- Golang从文件服务器获取图片显示到客户端
一.需求 A(客户端)--------------->B(服务端)-------------->C(文件服务器) 在客户端需要显示图片列表,但是不想C(文件服务器)的地址被暴露出来,所以现 ...
- zlib库的编译及使用
* 打开网址http://zlib.net/ 下载zlib源码, * 解压压缩包,进入目录:C:\Users\Administrator\Desktop\zlib-1.2.11\zlib-1.2.11 ...
- Verilog 位拼接运算符的优先级
最近研究FIFO的时候,在开源工程中看到这样一段代码 ; always @(posedge rd_clk) {'b0}}; else {'b0}}; else if(re) rp_bin <= ...
- OpenCV学习系列(零) Mac下OpenCV + xcode环境搭建
# OpenCV学习系列(零) Mac下OpenCV + xcode环境搭建 [-= 博客目录 =-] 1-学习目标 1.1-本章介绍 1.2-实践内容 1.3-相关说明 2-学习过程 2.1-hom ...
- 20145234黄斐《java程序设计》第十三周代码检查
在IDEA中对P145 MathTool.java 使用JUnit进行单元测试,测试用例不少于三个,要包含正常情况,边界情况. 提交测试代码和运行结果截图,加上学号水印,提交码云代码链接. 码云链接 ...
- 【BZOJ1046】[HAOI2007]上升序列
[BZOJ1046][HAOI2007]上升序列 题面 bzoj 洛谷 题解 \(dp\)完之后随便搞一下即可,注意不要看错题 代码 #include <iostream> #includ ...
- .Net Core和.Net Standard直观理解
.NET framework和.NET Core里面有一些部分,内容是相同的. 这部分相同的内容,就被称为标准库...即NET Standard Library. 而那些不同的部分,则分别叫做.NET ...
- Linux shell(3)
shell的运算操作: let整数运算 expr整数运算 bc浮点运算 字符串运算 let命令: let命令让BASH shell 执行算数值的操作,使用let,可以比较两个值或执行加减乘除等这样的算 ...
- 关于Myeclipse的MyEclipse:Java was started but returned exit code=-1 错误
我们在安装MyEclipse后有时会遇到这样一个问题,可以进入主界面软件也属于激活状态,但是过一会会报错, 并弹出MyEclipse:Java was started but returned exi ...