34 lines
364 B
C++
34 lines
364 B
C++
#include <iostream>
|
|
|
|
using namespace std;
|
|
|
|
namespace Circle
|
|
{
|
|
float r;
|
|
float s();
|
|
}
|
|
|
|
float Circle::s()
|
|
{
|
|
return 3.14 * r * r;
|
|
}
|
|
|
|
namespace Range
|
|
{
|
|
int w, h;
|
|
int s();
|
|
}
|
|
|
|
int Range::s()
|
|
{
|
|
return w * h;
|
|
}
|
|
|
|
int main()
|
|
{
|
|
cout << "输入半径:";
|
|
cin >> Circle::r;
|
|
float s1 = Circle::s();
|
|
cout << "面积: " << s1;
|
|
return 0;
|
|
} |