// This program demonstrates the ++ and -- operators.
#include <iostream>
using namespace std;
int main( )
{
int num = 4 ;
// Display the value in num.
cout << "The variable num is " << num << endl;
cout << "I will now increment num.\n \n " ;
// Use postfix ++ to increment num.
num ++ ;
cout << "Now the variable num is " << num << endl;
cout << "I will increment num again.\n \n " ;
// Use prefix ++ to increment num.
++ num;
cout << "Now the variable num is " << num << endl;
cout << "I will now decrement num.\n \n " ;
//Use postfix -- to decrement num.
num-- ;
cout << "Now the variable num is " << num << endl;
cout << "I will decrement num again.\n \n " ;
//Use prefix == to decrement num.
-- num;
cout << "Now the batiable num is " << num << endl;
return 0 ;
}
ICAgIC8vIFRoaXMgcHJvZ3JhbSBkZW1vbnN0cmF0ZXMgdGhlICsrIGFuZCAtLSBvcGVyYXRvcnMuCiAgICAjaW5jbHVkZSA8aW9zdHJlYW0+CiAgICB1c2luZyBuYW1lc3BhY2Ugc3RkOwogICAgIAogICAgaW50IG1haW4oKSAKICAgIHsKICAgIAlpbnQgbnVtID0gNDsKICAgICAKICAgIAkvLyBEaXNwbGF5IHRoZSB2YWx1ZSBpbiBudW0uCiAgICAJY291dCA8PCAiVGhlIHZhcmlhYmxlIG51bSBpcyAiIDw8IG51bSA8PCBlbmRsOwogICAgCWNvdXQgPDwgIkkgd2lsbCBub3cgaW5jcmVtZW50IG51bS5cblxuIjsKICAgICAKICAgICAKICAgIAkvLyBVc2UgcG9zdGZpeCArKyB0byBpbmNyZW1lbnQgbnVtLgogICAgCW51bSArKzsKICAgIAljb3V0IDw8ICJOb3cgdGhlIHZhcmlhYmxlIG51bSBpcyAiIDw8IG51bSA8PCBlbmRsOwogICAgCWNvdXQgPDwgIkkgd2lsbCBpbmNyZW1lbnQgbnVtIGFnYWluLlxuXG4iOwogICAgIAogICAgCS8vIFVzZSBwcmVmaXggKysgdG8gaW5jcmVtZW50IG51bS4KICAgIAkrK251bTsKICAgIAljb3V0IDw8ICJOb3cgdGhlIHZhcmlhYmxlIG51bSBpcyAiIDw8IG51bSA8PCB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