/* * @topic T00018 Feb 14, 2013 -- C++ expressions * @brief Increment <tt>++</tt> operator */ #include <iostream> int main() { int dummy = 1; // ++dummy; // prefix increment (pre-increment) // dummy++; // postfix increment (post-increment) // "++dummy" means "dummy = dummy + 1" if ( ++dummy == 2 ) { std::cout << "check 1: " << dummy << "\n"; } std::cout << "check 2: " << dummy << "\n"; return 0; } /*Program Output: check 2: 2 check 2: 2 */