Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/269.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C++;C#位运算符的代码段 我很难把C++的这部分移植到C语言中。我一直认为运算符“| |”不能应用于“long”和“long”类型的操作数,这是有意义的。那么,等价物是什么呢 while ((c <= combinations) && ((round_set & (1 << cList[c].one)) || (round_set & (1 << cList[c].two)) || (cUsed[c]))) { fprintf( stdout, "C: %d\n", c); c++; } while ((c <= combinations) && ((round_set & (1 << cList[c].one)) || (round_set & (1 << cList[c].two)) || (cUsed[c]))) { Console.WriteLine("C: {0}", c); c++; } while((c_C#_C++_Bit Manipulation - Fatal编程技术网

C++;C#位运算符的代码段 我很难把C++的这部分移植到C语言中。我一直认为运算符“| |”不能应用于“long”和“long”类型的操作数,这是有意义的。那么,等价物是什么呢 while ((c <= combinations) && ((round_set & (1 << cList[c].one)) || (round_set & (1 << cList[c].two)) || (cUsed[c]))) { fprintf( stdout, "C: %d\n", c); c++; } while ((c <= combinations) && ((round_set & (1 << cList[c].one)) || (round_set & (1 << cList[c].two)) || (cUsed[c]))) { Console.WriteLine("C: {0}", c); c++; } while((c

C++;C#位运算符的代码段 我很难把C++的这部分移植到C语言中。我一直认为运算符“| |”不能应用于“long”和“long”类型的操作数,这是有意义的。那么,等价物是什么呢 while ((c <= combinations) && ((round_set & (1 << cList[c].one)) || (round_set & (1 << cList[c].two)) || (cUsed[c]))) { fprintf( stdout, "C: %d\n", c); c++; } while ((c <= combinations) && ((round_set & (1 << cList[c].one)) || (round_set & (1 << cList[c].two)) || (cUsed[c]))) { Console.WriteLine("C: {0}", c); c++; } while((c,c#,c++,bit-manipulation,C#,C++,Bit Manipulation,c++),与c#不同,它允许您将整数值视为布尔值,即席处理,其中任何整数0都为false,而除0以外的任何整数都为true。c#不允许这样做 为了在C#中实现同样的效果,您必须明确地执行我刚才描述的检查,因此 if( (expr) || ... ) { } 你想要 if( (expr) != 0 || ... ) { } 实际上,后者在C++中仍然是完全可以接受的(有时是为了清晰而被鼓励)。

c++),与c#不同,它允许您将整数值视为布尔值,即席处理,其中任何整数
0
都为false,而除
0
以外的任何整数都为true。c#不允许这样做

为了在C#中实现同样的效果,您必须明确地执行我刚才描述的检查,因此

if( (expr) || ... ) { }
你想要

if( (expr) != 0 || ... ) { }

实际上,后者在C++中仍然是完全可以接受的(有时是为了清晰而被鼓励)。