forked from grantrostig/cpp_by_example
-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmain.cpp
More file actions
25 lines (22 loc) · 1.54 KB
/
main.cpp
File metadata and controls
25 lines (22 loc) · 1.54 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#include <iostream>
using namespace std;
int main() { {
int var_test_pre {1}, var_test_post {1}, test_pre {1}, test_post {1}, incrmnt_pre {1}, incrmnt_post {1};
for ( int var_declare {1}; // starting value, only evaluated once.
++var_test_pre, var_test_post++, ++test_pre < 99, true, test_post++ < 4; // evaluation and then test done before top of loop.
++incrmnt_pre, incrmnt_post++, var_declare++, true // increment done after bottom of loop before top eval and test.
) { cout << "var_declare: "<<var_declare
<< " var_test_pre: "<<var_test_pre<<" var_test_post: "<<var_test_post
<< " test_pre: "<<test_pre<<" test_post "<<test_post
<< " incrmnt_pre: "<<incrmnt_pre<<" incrmnt_post: "<<incrmnt_post<<endl; } }
int var_test_pre {1}, var_test_post {1}, test_pre {1}, test_post {1}, incrmnt_pre {1}, incrmnt_post {1};
for ( int var_declare {1}; // starting value, only evaluated once.
++var_test_pre, var_test_post++, test_post++ < 99, true, ++test_pre < 4; // evaluation and then test done before top of loop.
++incrmnt_pre, incrmnt_post++, var_declare++, true // increment done after bottom of loop before top eval and test.
) { cout << "var_declare: "<<var_declare
<< " var_test_pre: "<<var_test_pre<<" var_test_post: "<<var_test_post
<< " test_pre: "<<test_pre<<" test_post "<<test_post
<< " incrmnt_pre: "<<incrmnt_pre<<" incrmnt_post: "<<incrmnt_post<<endl; }
cout << "###" << endl;
return 0;
}