1 #+Title: a collection of examples for ob-C tests
5 :ID: fa6db330-e960-4ea2-ac67-94bb845b8577
8 #+begin_src cpp :includes "<iostream>" :results silent
14 #+begin_src cpp :var q=12 :includes "<iostream>" :results silent
20 #+begin_src cpp :var q=12 :var p=10 :includes "<iostream>" :results silent
26 #+begin_src cpp :var q="word" :includes '(<iostream> <cstring>) :results silent
27 std::cout << q << ' ' << std::strlen(q);
32 #+begin_src cpp :defines N 42 :includes "<iostream>" :results silent
39 :ID: 2df1ab83-3fa3-462a-a1f3-3aef6044a874
42 #+begin_src cpp :includes "<iostream>" :results vector :results silent
43 for (int i=1; i<3; i++) {
44 std::cout << i << '\n';
50 :ID: cc65d6b3-8e8e-4f9c-94cd-f5a00cdeceb5
57 #+begin_src cpp :var a='("abc" "def") :includes "<iostream>" :results silent
58 std::cout << a[0] << a[1] << sizeof(a)/sizeof(*a) << '\n';
62 #+begin_src cpp :var a='[1 2] :includes "<iostream>" :results silent
63 std::cout << a[0] << a[1] << sizeof(a)/sizeof(*a) << '\n';
66 #+source: list_list_var
67 #+begin_src cpp :var q=C-matrix :includes "<iostream>" :results silent
68 std::cout << q[0][0] << ' ' << q[1][0] << '\n'
69 << q[0][1] << ' ' << q[1][1] << '\n'; // transpose