Did I declare a variable wrong???

I'm compiling a program on tutorialspoint.com and an error keeps occurring whenever I try to compile it.

One of the if statements that check if one of the variables is set to a certain number keeps causing an error, and this error message is returned:

main.cpp:53:18: error: no match for 'operator==' (operand types are 'std::iostream {aka std::basic_iostream<char>}' and 'int')
if(repeat==1)

What I think is happening is the compiler thinks the variable's name is int!
This is the code:

1
2
3
4
5
6
  std::iostream<int> repeat = 1;

  if(repeat==1)
  {
   //code
  }


Did I do something wrong??
Please help me!
line 1 shouldn't compile, as iostream is not a template. the error you pasted is because the std::iostream class doesn't have an operator==.
Colin the error here is std is not needed .
Just declare an integer variable normally in this case. .int repeat = 1;
Last edited on
Topic archived. No new replies allowed.