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

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

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

最新文章

  1. Java 语句循环
  2. C# 使用Log4Net记录程序日志
  3. 一起来做chrome扩展《基础介绍》
  4. 【bzoj1562】 NOI2009—变换序列
  5. Apache中压力测试工具ab的操作说明
  6. Codeforces Round #143 (Div. 2)
  7. wikioi 1430 素数判定
  8. c#获取多个List&lt;class&gt;合并、并将相同条件下的值累计sum
  9. Google设计理念
  10. 【LeetCode从零单排】No15 3Sum
  11. 进程间通信系列 之 消息队列函数(msgget、msgctl、msgsnd、msgrcv)及其范例
  12. MySQL各模块工作配合
  13. Day-1: Python准备知识
  14. DNSmasq服务搭建
  15. 【NOIP2015资源+题解】
  16. lua 实现tableToString
  17. ELK 构建 MySQL 慢日志收集平台详解
  18. SimpleDateFormat日期格式解析
  19. Petrozavodsk Winter-2018. Carnegie Mellon U Contest
  20. PHP面试大全 基础篇100道问题

热门文章

  1. iOS裁剪,缩放图片白边问题解决办法
  2. 腾讯云Mac图床插件
  3. OracleLinux安装说明
  4. 【python3】将视频转换为代码视频
  5. 12 stark组件之pop,按钮,url,页面
  6. 实现对象属性的lazy-loading(延迟加载)
  7. cogs 421 [SDOI2009]HH的项链
  8. 提高你的Python编码效率的“武林秘籍”
  9. tikz中谐振子(弹簧)的绘制,以及声子色散关系的绘制
  10. 使用html2canvas将html标签转化为图片