2

Is it possible to run C++ and Python code in the same Jupyter notebook?

I've taught myself R using Jupyter notebooks where I would first solve a coding problem in Python and then write a similar solution in R. Having the code blocks right below each other helped me keep my skills sharp in Python, while learning a new language at the same time.

I now want to teach myself C++ with the same approach.

Jake
  • 25
  • 4
  • 3
    Not sure this is a good approach. One of the reasons you use C++ is to sit as close to the system hardware as possible, and that's not something you get to do in an interpreted universe. You will likely learn something C++-like, rather than C++. – user4581301 Aug 03 '21 at 23:53
  • In addition, "solve a coding problem" is one of the tougher approaches to picking up C++. I strongly recommend getting started with [a good set of books](https://stackoverflow.com/questions/388242/the-definitive-c-book-guide-and-list) and working through one of them lesson by lesson to pick up the fundamentals. C++ offers a lot of pathways to getting things done and some of them are a lot better than others. The sooner you get on a good path, the sooner you're producing efficient, easy to maintain code rather than code that simply works. – user4581301 Aug 03 '21 at 23:57

1 Answers1

2

Frankly, if you wanted to learn C++, I would encourage you to use an IDE with full-fledged support for C++ like Microsoft Visual Studio or Visual Studio Code, or Code::Blocks, among many others:

All of the above options support good compilers, debuggers and on-line C++ documentation (including Intellisense). You'd probably be doing a disservice to yourself if you chose an IDE that didn't have these features.

However, I believe you CAN run C++ (at least some versions, to some extent) from Jupyter:

paulsm4
  • 107,438
  • 16
  • 129
  • 179