博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
课堂作业1
阅读量:4696 次
发布时间:2019-06-09

本文共 715 字,大约阅读时间需要 2 分钟。

题目描述: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.

代码如下:

main.cpp:

#include 
#include "cal.h"using namespace std;int main(){ double s, r; cout << "please input the radius" << endl; while (cin >> r) { cout << "The area is " << calS(r) << endl; } return 0;}

cal.cpp:

#include 
#include "cal.h"#define pi 3.14using namespace std;double calS(double r){ double s; s = r * r * pi; return s;}

cal.h:

double calS(double r);

转载于:https://www.cnblogs.com/kurisu/p/5464058.html

你可能感兴趣的文章
linux跳过root密码登陆
查看>>
mini2440 U-boot 编译
查看>>
学习ThreadLocal
查看>>
在 Visual Studio 调试器中指定符号 (.pdb) 和源文件
查看>>
直接量
查看>>
leetcode 115. 不同的子序列(Distinct Subsequences)
查看>>
三元表达式
查看>>
Oauth支持的5类 grant_type 及说明
查看>>
客户端第一天学习的相关知识
查看>>
LeetCode - Same Tree
查看>>
Python dict get items pop update
查看>>
[置顶] 程序员必知(二):位图(bitmap)
查看>>
130242014036-(2)-体验敏捷开发
查看>>
constexpr
查看>>
Nginx 流量和连接数限制
查看>>
课堂作业1
查看>>
IE8/9 本地预览上传图片
查看>>
Summary of CRM 2011 plug-in
查看>>
Eclipse+Maven环境下java.lang.OutOfMemoryError: PermGen space及其解决方法
查看>>
安全漏洞之Java
查看>>