증가/감소 연산자
Oshirish/kamaytirish operatorlari obyekt qiymatini oshiradi yoki kamaytiradi.
Pre-increment and pre-decrement operatorlari ob'ekt qiymatini oshiradi yoki kamaytiradi va natijaga havolani qaytaradi.
O'sish va pasayishdan keyingi ob'ekt nusxasini yaratadi, ob'ekt qiymatini oshiradi yoki kamaytiradi va ko'paytirish yoki kamaytirishdan oldingi nusxani qaytaradi.
int num = 57;
cout << "\n\n Display the operation of pre and post increment and decrement :\n";
cout << "---------------------------------------------\n";
cout <<" The number is : " << num << endl;
num++; // increase by 1 (post-increment)
cout <<" After post increment by 1 the number is : " << num << endl;
++num; // increase by 1 (pre-increment)
cout <<" After pre increment by 1 the number is : " << num << endl;
num = num + 1; // num is now increased by 1.
cout <<" After increasing by 1 the number is : " << num << endl; // 79
num--; // decrease by 1 (post-decrement)
cout <<" After post decrement by 1 the number is : " << num << endl;
--num; // decrease by 1 (pre-decrement)
cout <<" After pre decrement by 1 the number is : " << num << endl;
num = num - 1; // num is now decreased by 1.
cout <<" After decreasing by 1 the number is : " << num << endl;
cout << endl;
Reference
이 문제에 관하여(증가/감소 연산자), 우리는 이곳에서 더 많은 자료를 발견하고 링크를 클릭하여 보았다 https://dev.to/faxridd1n/incrementdecrement-operators-5aam텍스트를 자유롭게 공유하거나 복사할 수 있습니다.하지만 이 문서의 URL은 참조 URL로 남겨 두십시오.
우수한 개발자 콘텐츠 발견에 전념 (Collection and Share based on the CC Protocol.)