获取“无匹配”操作符>> “,错误在我的C ++代码 [英] Getting a "no match for 'operator>>' " error in my C++ code
本文介绍了获取“无匹配”操作符>> “,错误在我的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 >>(操作数类型为'std :: basic_istream :: __ istream_type {aka std :: basic_istream}'和'')
no match for 'operator>>' (operand types are 'std::basic_istream::__istream_type {aka std::basic_istream}' and '')
当我的代码接收到输入时,我收到此错误。
I get this error whenever my code receives input.
推荐答案
您不能 cin>>
某些东西到 endl
。这没有意义 - endl
是一个构造,以给予像 cout
的指令,做任何是正确的在你的特定平台上结束一行,而不是你可以保存输入。
You don't cin >>
something to endl
. That doesn't make sense – endl
is a construct to give things like cout
the instruction to do whatever is right to end a line on your specific platform, not something you can save input to.
这篇关于获取“无匹配”操作符>> “,错误在我的C ++代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文