## C++随机数的四则运算

在这里插入代码片

 ## C++随机数的四则运算


  
  #include <iostream>
using namespace std;
double S(double r,double pi=3.14);
int main()
{
    cout<<"please enter the r:";
    double r=0;
    cin>>r;
    cout<<"pi is 3.14,do you want to change this(y/n)?";
    char changepi='n';
    cin>>changepi;
    double s=0;
    if(changepi=='y')
    {
        cout<<"enter new pi:";
        double newpi=3.14159;
        cin>>newpi;
        s=S(r,newpi);
    }
    else
        s=S(r);
    cout<<"S is:"<<s<<endl;
    return 0;
}
double S(double r,double pi)
{
    return pi*r*r;
}



我是初入行的小白菜,我会坚持每天把我学到的知识发在博客上,如果你是白菜可以借鉴学习编程哦!如果你是大佬还望带带我这个小跟班,谢谢!

猜你喜欢

转载自blog.csdn.net/m0_45864023/article/details/103448920
今日推荐