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
To'g'ri o'zlashtirishga misollar:
x = 5;
x = y;
y = x + 10;
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;
Top comments (0)