c++求改错

P1035 [NOIP2002 普及组] 级数求和

u55545554 @ 2017-09-05 13:20:34

#include<iostream> 
using namespace std;
int main()
{
    float Sn=0,n;
    int k;
    cin>>k;
    for(n=1.0;;n++)
    {
        Sn+=1.0/n;
        if(Sn>k)
        {
            break;
        }
    }
    cout<<n;
}

by smallfish @ 2017-09-06 20:24:34

是无法编译吗


by smallfish @ 2017-09-06 20:25:47

没有return 0


|