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 ...
随机推荐
- PHP中上传文件打印错误,错误类型
一般使用$_FILES来进行文件上传时,可以使用$_FILES["file"]["error"]来判断文件上传是否出错.$_FILES["file&q ...
- [Oracle]如何查看一个数据文件是否是自动扩展
开始 SQL> col file_id format 99SQL> col file_name format a50SQL> col tablespace_name format a ...
- c++ 双向链表 的查找和删除
#include <stdio.h> #include <stdlib.h> #include <string.h> #include <ctype.h> ...
- 【转载】MSXML应用总结 开发篇(上)
原文:http://blog.sina.com.cn/s/blog_48f93b530100ejv9.html 本篇是接前文“MSXML应用总结 概念篇”写的,主要总结一下MSXML DOM接口的应用 ...
- Kafka系列三 java API操作
使用java API操作kafka 1.pom.xml <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xs ...
- shell命令注意点
unset 不能删除readonly的变量 实例: #!/bin/bash name="lalala" readonly name unset name 执行结果: line5:u ...
- JS ,substr、 substring、charAt方法的区别
JS 截取字符串substr 和 substring方法的区别,需要的朋友可以参考下,根据需要自行选择. substr 方法 返回一个从指定位置开始的指定长度的子字符串. stringvar.subs ...
- linux 问题收集
1,错误信息:bunzip2: command not found 解决方法:yum install -y bzip2 2,The X11 forwarding request was rejecte ...
- 【PaPaPa】系统架构搭建浅析 - 人人可以搭架构
声明 [PaPaPa]这个项目是以技术分享与研究为目的而做的,并非商业项目,所以更多的是提供一种思路,请勿直接在项目中使用. 上一篇隐藏开源项目地址实属无奈,为了寻找一起做这件事的同伴不得已刷了一天推 ...
- AltiumDesigner 热焊盘铺铜
在layout中,引脚与大面积的铺铜完全连接容易造成过分散热而产生虚焊以及避免因过分散热而必须使用大功率焊接器,因此在大面积铺铜时,对于接地引脚,我们经常使用热焊盘.在AltiumDesigner 中 ...