Nodebook
  • Introduction
  • Methods
  • Default Classes
    • Nodebook
  • JS
    • JSONotebook
    • JSNotebook
    • TSNotebook
  • Java
    • JavaNotebook
  • C/C++
    • CPPNotebook
    • CNotebook
    • HeaderNotebook
  • Text
    • TXTNotebook
    • MDNotebook
    • PlainNotebook
  • Web
    • HTMLNotebook
    • CSSNotebook
      • CSSStyle
  • Other
    • YMLNotebook
    • BashNotebook
  • Python
    • PYNotebook
Powered by GitBook
On this page
  • Usage
  • Setup

Was this helpful?

  1. C/C++

CPPNotebook

extends Nodebook

"CPPNotebook" is a customized class for C++ (.cpp) files.

Usage

Setup

const Nodebook = require('nodejs-notebook');

const main = new Nodebook.CPPNotebook('main');

note(code)

Similar to addLine() but it does not automatically add an indent.

string code: The C++ code to add.

main.note('#include <iostream>\n\nusing namespace std;\nint main() {\n\ncout << "hello world"\n}'
// Inserts this long line of code that should output "hello world"

comment(comment)

Insert a C++ Comment.

string comment: The comment message to add.

main.comment('This needs editing, Franchis!');
// Inserts "/* This needs editing , Franchis! */"

compile()

Attempts to compile the C++ file.

main.compile();
// Will output if there were any errors in the console.

include(module)

Inserts #include <> at the top with the module provided.

main.include('iostream');
// Inserts "#include <iostream>"
PreviousJavaNotebookNextCNotebook

Last updated 4 years ago

Was this helpful?