DEV Community

islomAli99
islomAli99

Posted on

Assignment(O'zlashtirish) (=) operatori

Image description

  • o'zgaruvchiga qiymat o'zlashtirish uchun ishlatiladi.

  • o'zlashtirish operatori (=) chap tarafida doimo o'zgaruvchi turishi shart.

200 = x;       // error - chap tarafda qiymat turibdi
x + 1 = 200    // error - chap tarafda ifoda turibdi
Enter fullscreen mode Exit fullscreen mode

To'g'ri o'zlashtirishga misollar:

x = 5;
x = y;
y = x + 10;
Enter fullscreen mode Exit fullscreen mode

Mashq
Quydagi ifodalar natijalarini taxmin qiling!

cout << 3 * 4 << endl;
cout << 2.0 * 3.0 << endl;
cout << 2.0 * 4 << endl;
cout << 10 / 2 << endl;
cout << 10 / 3 << endl;
cout << 10 / 3.0 << endl;
cout << 10 % 3 << endl;
cout << 3.0 + 3 / 2 << endl;
Enter fullscreen mode Exit fullscreen mode

Top comments (0)