C ++中的'and'关键字

Uts*_*haw 1 c++

我已经看到and 关键字if&&运算符一样在语句内部使用。这些(and&&)有什么区别?

#include <iostream>

using namespace std;

int main()
{
bool a = true;
bool b = true;

if(a==true and b==true) // if(a==true && b == true)
{
    cout << "YES ";
}


return 0;
}
Run Code Online (Sandbox Code Playgroud)

use*_*321 6

是的,至少从C ++ 98开始,new 和关键字就出现了。它的操作与&&操作员相同。


Tyg*_*ger 5

and和中没有区别&&。您还可以使用not代替!or代替||