Ask coding questions

← Back to all posts
Why does the > not work
JosiasToze (0)

I'm learning c++ and I was trying to use the >= symbol but it gives me an error and I even tried it by itself but it still is coming up as an error
while (ez==true)
{
std::cout <<"BOLLEANS FINNALY";
int counter = int (counter+1);

   if(int counter **>=** 10)
   {
     bool ez = false;
   };
 };
 std::cout <<"bye";
 return 0;}
Answered by Coder100 (18930) [earned 5 cycles]
View Answer
Comments
hotnewtop
Coder100 (18930)

A few things.
First, you don't need to cast 2 ints together... they already are ints!
Second, because you already declared int, you do not nee dot set the type. C++ already knows it.

int counter = 0;

while (ez == true) {
  ...
  counter++;
  if (counter >= 10) {
    bool ez = false;
  }
  ...
}