c++程序为什么没有进入定义的函数?
#include<iostream>#include<cmath>usingnamespacestd;doubleround(doublenum);intmain(){d...
#include<iostream>
#include<cmath>
using namespace std;
double round(double num);
int main()
{
double k;
cout<<"输入一个正数:";
cin>>k;
cout<<"\n";
double round(double k);
return 0;
}
double round(double num)
{
double val;
int n;
n=modf(num,&val);
if(val<0.5) cout<<"四舍五入后的正数是: "<<n;
else cout<<"四舍五入后的数是:"<<n;
} 展开
#include<cmath>
using namespace std;
double round(double num);
int main()
{
double k;
cout<<"输入一个正数:";
cin>>k;
cout<<"\n";
double round(double k);
return 0;
}
double round(double num)
{
double val;
int n;
n=modf(num,&val);
if(val<0.5) cout<<"四舍五入后的正数是: "<<n;
else cout<<"四舍五入后的数是:"<<n;
} 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询