在 Jupyter Notebook 中运行 C/C++ 代码需要使用一个名为 Cython 的 Jupyter 扩展。首先需要安装 Cython,可以使用命令 "!pip install cython" 在 Jupyter Notebook 中安装。然后,你可以使用 "%%cython" 指令在 Jupyter Notebook 中创建 C/C++ 代码并运行。例如:
%%cython
defadd(int x, int y):
return x + y
print(add(1, 2))
你也可以使用其他 Jupyter 扩展,例如 Xeus-Cling,来运行C/