注册 登录
编程论坛 C++教室

初学者求教error c2679

G梦 发布于 2013-02-24 21:33, 363 次点击
error C2679: binary '>>' : no operator defined which takes a right-hand operand of type '' (or there is no acceptable conversion)
Error executing cl.exe.
这个错误肿么破
4 回复
#2
G梦2013-02-24 21:41
附上代码:#include<iostream>
using namespace std;
int Hn( int n,float x);
int main()
{
    int n,i;
    float s,x;
    cin>>n>>endl;
    cin>>x>>endl;
    for(i=0;i<=n;i++)
    {
        s=Hn(i,x);
        cout<<s<<endl;
    }
    return 0;
}
      

 int Hn(int n, float x)
    {
      
        float k;
        if (n==0)
            k=1;
        else if (n==1)
            k=2*x;
        else  
            k=2*x*Hn(n-1,x)-2*(n-1)*Hn(n-2,x);  
        return k;
    }
#3
G梦2013-02-24 22:42
哈哈 我搞定了
自娱自乐好了
#4
wp2319572013-02-25 08:13
结贴 哈哈
记得下次问问题 先把代码贴出来  然后再提出问题
#5
逆风而前2013-02-25 21:31
int main()
{
    int n,i;
    float s,x;
    cin>>n;
    cin>>x;
    for(i=0;i<=n;i++)
    {
        s=Hn(i,x);
        cout<<s<<endl;
    }
    return 0;
}
cout<<a<<endl;cout时才可以用endl;endl表示换行。
1