pow()需要导入#include
sqrt() 用来求给定值的平方根
setiosflags(ios::fixed) << setprecision(2)需要导入#include
用π可以用 #define PI 3.14159
/*
输入圆的半径,求圆的周长和面积。 要求定义圆周率为如下宏常量
#define PI 3.14159
输入
输入半径r的值,为一实数。
输出
输出一行,包括周长和面积。数据之间用一个空格隔开,数据保留小数后面两位。
样例输入 Copy
3
样例输出 Copy
18.85 28.27*/
#include <iostream>
#include <iomanip>
#include<cmath>
#define PI 3.14159
using namespace std;
int main()
{
double r;
double l, s;
cin >> r;
l = 2 * PI*r;
s = PI * pow(r,2);
cout << setiosflags(ios::fixed) << setprecision(2) << l << ' '<< s;
return 0;
}