Online JudgeProblem SetAuthorsOnline ContestsUser
Web Board
Home Page
F.A.Qs
Statistical Charts
Problems
Submit Problem
Online Status
Prob.ID:
Register
Update your info
Authors ranklist
Current Contest
Past Contests
Scheduled Contests
Award Contest
User ID:
Password:
  Register

哪位大神帮忙改一下

Posted by sugerlily at 2014-08-01 09:16:51
#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:
User ID:
Password:
Title:

Content:

Home Page   Go Back  To top


All Rights Reserved 2003-2013 Ying Fuchen,Xu Pengcheng,Xie Di
Any problem, Please Contact Administrator