Cpp Basic 63: Math increment decrement

11 January 2020, 5:23 pm by antelove19

C++ programming language

C++ programming language



Happy Coding


main.cpp

/* ------------------------------------------------------------ */
/*  Math                                                        */
/*  Using Arithmetic Operators increment and decrement          */
/*                                                              */
/*  Author: antelove                                            */
/*  Website: antelove.com                                       */
/* ------------------------------------------------------------ */

#include <iostream>

using namespace std;

int main()
{

    int x = 10;

    // increment
    cout << "x     = " << x << endl;
    cout << "x + 1 = " << x + 1 << endl;

    x++;
    cout << "x++   = " << x << endl;


    cout << "-----------------" << endl;


    int y = 20;

    // decrement
    cout << "y     = " << y << endl;
    cout << "y - 1 = " << y - 1 << endl;

    y--;
    cout << "y--   = " << y << endl;

    return 0;

}

Thank for reading :)


Keywords:


No Action Title
1 Live
2 Editor
0 comment