Prefix and postfix



// Prefixandpostfix.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"
#include "iostream"
using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{
       int i, j, k, m, n;
       i = 2;
       j = i;
       k = 3;
       ++i;
       i++;
       m = i++ / k; //Assigns 0 to m.
       n = ++j / k; //Assigns 1 to n.
       cout << "i = " << i <<"\n"<<"m = " << m <<
             "\nn = " << n << "\ni = " << i << "\nj = "
             << j << "\n";
       system("pause");
       return 0;
}


Share on Google Plus