64,685
社区成员
发帖
与我相关
我的任务
分享
#define PI 3.1415926
#include <iostream>
using namespace std;
int main()
{
int r, c, s;
cout << "请输入圆的半径";
cin >> r;
if (r > 0) { //mark
c = 2 * PI * r;
s = PI * r * r;
cout << "圆的周长为:" << c << endl;
cout << "圆的面积为:" << s << endl;
}//mark
else
cout << "你家的圆长得这样的- -'" << endl;
return 0;
}
if(r>0)
{
c=2*PI*r;
s=PI*r*r;
cout<<"圆的周长为:"<<c<<endl;
cout<<"圆的面积为:"<<s<<endl;
}
#include <iostream>
#define PI 3.1415926
using namespace std;
int main()
{
double r,c,s;
cout<<"请输入圆的半径";
cin>>r;
if(r>0)
{
c=2*PI*r;
s=PI*r*r;
cout<<"圆的周长为:"<<c<<endl;
cout<<"圆的面积为:"<<s<<endl;
}
else
{
cout<<"你家的圆长得这样的- -'"<<endl;
}
return 0;
}