1个回答
2008-08-28
展开全部
#include<iostream>
#include <cmath>
using namespace std;
int main()
{
float f;
int i = 0 ;
while(cin>>f)
{
if(f == 0.00)break;
int n = 0;
float sum = 0;
float temp= -1;
for(i = 2;f > sum;i++)
{
sum = sum+ (float)1/i;
//cout<<sum<<endl;
}
cout<<i - 2<<" card(s)"<<endl;
}
system("pause");
return 0;
}
#include <cmath>
using namespace std;
int main()
{
float f;
int i = 0 ;
while(cin>>f)
{
if(f == 0.00)break;
int n = 0;
float sum = 0;
float temp= -1;
for(i = 2;f > sum;i++)
{
sum = sum+ (float)1/i;
//cout<<sum<<endl;
}
cout<<i - 2<<" card(s)"<<endl;
}
system("pause");
return 0;
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询