Debian Codegraph @

examples/prism-cpp.html

raw symbols SCIP
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 &lt;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 &lt;iostream>
28 #include &lt;vector>
29 using namespace std;
30
31 vector&lt;int> pick_vector_with_biggest_fifth_element(
32 vector&lt;int> left,
33 vector&lt;int> right
34 ){
35 if( (left[5]) &lt; (right[5]) ){
36 return( right );
37 };
38 // else
39 return( left );
40 }
41
42 int vector_demo(void){
43 cout &lt;&lt; "vector demo" &lt;&lt; endl;
44 vector&lt;int> left(7);
45 vector&lt;int> right(7);
46
47 left[5] = 7;
48 right[5] = 8;
49 cout &lt;&lt; left[5] &lt;&lt; endl;
50 cout &lt;&lt; right[5] &lt;&lt; endl;
51 vector&lt;int> biggest(
52 pick_vector_with_biggest_fifth_element( left, right )
53 );
54 cout &lt;&lt; biggest[5] &lt;&lt; endl;
55
56 return 0;
57 }
58
59 int main(void){
60 vector_demo();
61 }</code></pre>