超简单问题啊!赚分了!
#include "iostream.h"
void main()
{
float temp=0;
float c;
int n=1;
float t;
while(c!=temp)
{
cout<<"please input number"<<endl;
cin>>c;
if(c<0.01||c>5.20||c==0)
{
cout<<"ERRor"<<endl;
break;
}
else if(0.01<c&&c<5.20)
{
while(c!=(int)(temp))
{
* temp=temp+1/(n+1);
* t=1/(n+1);
* n++;
}
}
}
cout<<n;
}
t=1/(n+1)为什么总是零啊。怎么才能让除下来不是零啊?