| ||||||||||
| Online Judge | Problem Set | Authors | Online Contests | User | ||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Web Board Home Page F.A.Qs Statistical Charts | Current Contest Past Contests Scheduled Contests Award Contest | |||||||||
哪位大神帮忙改一下#include<iostream>
#include<cmath>
#include<string>
#include<sstream>
using namespace std;
string ToString(double num);
void pt(double r,int m);
void main()
{
double R;
int n;
while(cin>>R>>n)
pt(R,n);
}
void pt(double r,int m)
{
double s;
double a;
int b;
if(r<1)
{
a=pow(r,m);
b=sizeof(ToString(a))-2;
s=a*pow(10,b);
cout<<"."<<s;
}
else
{
s=pow(r,m);
cout<<s;
}
}
string ToString(double num)
{
ostringstream oss(num);
return oss.str();
}
Followed by: Post your reply here: |
All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator