| 1 | <h2>Strings</h2> |
| 2 | <pre><code>"foo \"bar\" baz" |
| 3 | 'foo \'bar\' baz' |
| 4 | "Multi-line strings ending with a \ |
| 5 | are supported too."</code></pre> |
| 6 | |
| 7 | <h2>Macro statements</h2> |
| 8 | <pre><code># include <stdio.h> |
| 9 | #define PG_locked 0 |
| 10 | #define PG_error 1 |
| 11 | </code></pre> |
| 12 | |
| 13 | <h2>Booleans</h2> |
| 14 | <pre><code>true; |
| 15 | false;</code></pre> |
| 16 | |
| 17 | <h2>Operators</h2> |
| 18 | <pre><code>a and b; |
| 19 | c bitand d;</code></pre> |
| 20 | |
| 21 | <h2>Full example</h2> |
| 22 | <pre><code>/* |
| 23 | David Cary 2010-09-14 |
| 24 | quick demo for wikibooks |
| 25 | public domain |
| 26 | */ |
| 27 | #include <iostream> |
| 28 | #include <vector> |
| 29 | using namespace std; |
| 30 | |
| 31 | vector<int> pick_vector_with_biggest_fifth_element( |
| 32 | vector<int> left, |
| 33 | vector<int> right |
| 34 | ){ |
| 35 | if( (left[5]) < (right[5]) ){ |
| 36 | return( right ); |
| 37 | }; |
| 38 | // else |
| 39 | return( left ); |
| 40 | } |
| 41 | |
| 42 | int vector_demo(void){ |
| 43 | cout << "vector demo" << endl; |
| 44 | vector<int> left(7); |
| 45 | vector<int> right(7); |
| 46 | |
| 47 | left[5] = 7; |
| 48 | right[5] = 8; |
| 49 | cout << left[5] << endl; |
| 50 | cout << right[5] << endl; |
| 51 | vector<int> biggest( |
| 52 | pick_vector_with_biggest_fifth_element( left, right ) |
| 53 | ); |
| 54 | cout << biggest[5] << endl; |
| 55 | |
| 56 | return 0; |
| 57 | } |
| 58 | |
| 59 | int main(void){ |
| 60 | vector_demo(); |
| 61 | }</code></pre> |