@@ -2,12 +2,12 @@ Tutorials
2
2
---------
3
3
4
4
This tutorial emphasises the abilities and usage of Xeus-cpp. Let's get
5
- started! The tutorial demonstrates examples of C++ and C++-python integration
5
+ started! The tutorial demonstrates examples of C++
6
6
on Jupyter kernels.
7
7
8
8
1. Install the xeus-cpp from source using conda-forge for fetching dependencies.
9
9
10
- 2. Launch the Jupyter Notebook with C++-14, C++-17 kernels available.
10
+ 2. Launch the Jupyter Notebook with C++-11, C++- 14, C++-17 kernels available.
11
11
12
12
3. In a code cell, write the C++ code.
13
13
@@ -17,53 +17,17 @@ on Jupyter kernels.
17
17
C++
18
18
===
19
19
20
- .. image :: sum .png
20
+ .. image :: fibonacci .png
21
21
:width: 200px
22
22
:height: 100px
23
- :scale: 250 %
23
+ :scale: 300 %
24
24
:align: center
25
25
26
26
In this example, you can modify the code and execute the cell again to see the
27
- updated results. For example, you might change the values of `a ` and ` b `
28
- (function arguments) of the function `sum ` to see expected output. You can try
27
+ updated results. For example, you might change the values of `n` `
28
+ (function arguments) of the function `nthFibonacci ` to see expected output. You can try
29
29
out different examples to explore the features of C++.
30
30
31
31
The output of the cell will be displayed below once the code is executed and
32
32
xeus-cpp provides an interactive environment, where you can promptly make
33
33
the changes and prototype in C++.
34
-
35
- C++-Python Integration:
36
- =======================
37
-
38
- .. image :: integration-demo.png
39
- :width: 200px
40
- :height: 100px
41
- :scale: 400 %
42
- :align: center
43
-
44
- In this example, we are emphasising the concept of C++-Python integration, where
45
- we use Python and C++ in the same session, sharing variables, scopes, and features.
46
- Here, we have used variables (`new_var1 `, `new_var2 `, `new_var3 `)
47
- in python which have been initialised in C++. In the following context, we have
48
- tried the vice versa as well of using the variables in Python (`new_python_var `)
49
- which have been defined in C++.
50
-
51
- .. code-block :: bash
52
-
53
- In[1] # include <iostream>
54
-
55
- In[2] void Cpp () {
56
- std::cout << "Hello World C++!" << std::endl;
57
- }
58
-
59
- In[3] %%python
60
-
61
- In[4] Cpp()
62
-
63
- We are taking another example of working with functions that can be used in
64
- to call functions defined in C++ in python code with help of magic commands.
65
-
66
- The project is under development and is subject to changes as C++-Python integration
67
- within the same Jupyter cell is quite challenging. Please ensure that you have
68
- xeus-cpp and your Jupyter environment set up before attempting to run C++
69
- code. The installation instructions can be found in this documentation for xeus-cpp.
0 commit comments