Оператор (програмиране): Разлика между версии

Изтрито е съдържание Добавено е съдържание
Tddhome (беседа | приноси)
Ред 151:
Console.WriteLine(!b); // На конзолата ще се изпише True
</source>
 
===побитови оператори===
<source lang="csharp">
int a = 3; // 0000 0011 = 3
int b = 5; // 0000 0101 = 5
Console.WriteLine( a | b); // 0000 0111 = 7
Console.WriteLine( a & b); // 0000 0001 = 1
Console.WriteLine( a ^ b); // 0000 0110 = 6
Console.WriteLine(~a & b); // 0000 0100 = 4
Console.WriteLine(a << 1); // 0000 0110 = 6
Console.WriteLine(a << 2); // 0000 1100 = 12
Console.WriteLine(a >> 1); // 0000 0001 = 1
</source>
===оператори за сравнение===
<source lang="csharp">
int x = 10, y = 5;
Console.WriteLine(“x > y : “ + (x > y)); // true
Console.WriteLine(“x < y : “ + (x < y)); // false
Console.WriteLine(“x >= y : “ + (x >= y)); // true
Console.WriteLine(“x <= y : “ + (x <= y)); // false
Console.WriteLine(“x == y : “ + (x == y)); // false
Console.WriteLine(“x != y : “ + (x != y)); // true
</source>
===условни оператори===
<source lang="csharp">
int a = 6;
int b = 4;
Console.WriteLine(a > b ? “a>b” : “b<=a”); // a>b
</source>
== Операторите в [[Java]]==
===аритметични оператори===