[Dev-C++] Pos and Pre Incremental/Decremental Operators Examples
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
|
From: <and...@su...> - 2003-05-13 02:25:22
|
Dear Users: Please consider the following examples: Example 1: ... int c; c=0; cout << c++; ---> it will print 0; cout << c; ---> it will print 1; c=0; cout << ++c; ---> it will print 1; cout << c; ---> it will print 1; ... Example 2: ... 1-int i; 2-for(i=0; i<10; i++) cout << i; ---> it will print 0 to 9 3-for(i=0; i<10; ++i) cout << i; ---> it will print 0 to 9 (too!) Statements/Questions: 1-I only have example #1 style to teach pos and pre incremental operators; 2-I thought in Example 2, line 3 an output like numbers 1 to 10. Why this not happens? 3-Does anybody have good and simple examples of using pos and pre incremental/decremental operators? Regards Andre |