pr0524.cpp
来自「practice c++, it is from the book http:/」· C++ 代码 · 共 24 行
CPP
24 行
// Programming with C++, Second Edition, by John R. Hubbard
// Copyright McGraw-Hill, 2000
// Problem 5.24 on page 114
// A Function that Computes Formulas for Circles
#include <iostream> // defines the cin and cout objects
using namespace std;
void computeCircle(double& area, double& circ, double r);
int main()
{ double a, c, r;
cout << "Enter the radius: ";
cin >> r;
computeCircle(a,c,r);
cout << "The area of a circle of radius " << r << " is " << a
<< "\nand its circumference is " << c << endl;
}
void computeCircle(double& area, double& circ, double r)
{ const double PI=3.141592653589793;
area = PI*r*r;
circ = 2*PI*r;
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?