how to use decrement operator in c++
#include <iostream>
using namespace std;
int main()
{
int x = 5, y = 5;
cout << x-- << " " << --y ;
// Outputs 5 4
return 0;
}
how to use decrement operator in c++
#include <iostream>
using namespace std;
int main()
{
int x = 5, y = 5;
cout << x-- << " " << --y ;
// Outputs 5 4
return 0;
}
C++ Increment and Decrement
int b, a, e, d, c, f;
int num = 57;
cout << "The number is " << num << endl;
b = ++num;
a = ++num;
e = a + 1;
cout << "After post increment by 1, the number is " << b << endl;
cout << "After pre increment by 1, the number is " << a << endl;
cout << "After increasing by 1, the number is " << e << endl;
d = --e;
c = --e;
f = c - 1;
cout << "After post decrement by 1, the number is " << d << endl;
cout << "After pre decrement by 1, the number is " << c << endl;
cout << "After decreasing by 1, the number is " << f << endl;
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us