Skip to content

A simple IPython extension that runs C++ code and shows the output. Supports command-line input to g++.

License

Notifications You must be signed in to change notification settings

dragly/cppmagic

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

cppmagic

A simple IPython extension that runs C++ code and shows the output. Supports command-line input to g++.

Example output

http://nbviewer.ipython.org/urls/raw.github.com/dragly/cppmagic/master/example.ipynb

Installation

Simply download and try the example.ipynb notebook that you'll find in the root folder of this repository.

Usage

Run the following commands in one cell. This will download the cppmagic module and load it.

%install_ext https://raw.github.com/dragly/cppmagic/master/cppmagic.py
%load_ext cppmagic

Then create a new cell like this:

%%cpp
#include <iostream>
using namespace std;

class MyClass {
public:
    int a;
    MyClass() {
        a = 10;
    }
};

int main() {
    MyClass B;
    cout << B.a << endl;
    return 0;
}

About

A simple IPython extension that runs C++ code and shows the output. Supports command-line input to g++.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages