得到“不匹配'运算符>>' “我的C ++代码中的错误

时间:2016-06-05 11:21:53

标签: c++

#include <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
using namespace std;

int main() {
    long int T,n ;
    long int x,y,z,i,j;
    cin >> T >> endl ;
    for(j=1;j<=T;j++) {   
        cin >> n >> endl ;
        if((T>=1&&T<100000)&&(n>=1&&n<=8000000)){
            for(x=1;x<=8000000;x++)
                for(y=1;y<=8000000;y++){
                    for(z=1;z<=8000000;z++){
                        if(((y-x)==(z-y))&&((x*x)-(y*y)-(z*z)==n))
                            i++ ;
                        else continue; 
                    }
                }   
            }
        }
    cout << i;
    return 0;
}

我得到的错误是:

  

与'operator&gt;&gt;'不匹配(操作数类型是'std :: basic_istream :: __ istream_type {aka std :: basic_istream}'和'')

每当我的代码收到输入时,我都会收到此错误。

1 个答案:

答案 0 :(得分:5)

你不要cin >>某事endl。这没有任何意义 - endl是一个构造,可以为cout提供指令来执行任何在特定平台上结束行的权利,而不是可以保存输入的内容。