2021年1月15日星期五

Using logical operators in loops [closed]

How can I make a while loop take in both arguments and not just one?

My code:

int main()  {      int a = 1;      int x = 0;      while (x == 0 && a == 0)      {          std::cout << "text1" << std::endl;          x++;      }      std::cout << "text2" << std::endl;  }  

This should printing out text1 all the time (constantly), but it does not. Instead, it skips the whole loop and prints out text2.

https://stackoverflow.com/questions/65727052/using-logical-operators-in-loops January 15, 2021 at 05:17AM

没有评论:

发表评论