0

How can i Run C ++ code to add two numbers within the NodeJs ?

Code to Add two numbers in C++:

       #include <iostream>
       using namespace std;
       int main()
       {
       int num1, num2, result;
       num1 = 1;
       num2 = 1;
       result = num1 + num2; 
       cout << result << endl;
       return 0;
       }
  • 3
    Does this answer your question? [How can I use a C++ library from node.js?](https://stackoverflow.com/questions/9629677/how-can-i-use-a-c-library-from-node-js) – Botje May 13 '20 at 08:45

1 Answers1

-1

There are many examples in node-addon-api. here's one for calculating Pi in C++ and pass result back to Node.js

https://github.com/nodejs/node-addon-examples/tree/master/async_pi_estimate/node-addon-api

repo: https://github.com/nodejs/node-addon-examples

Tuan Anh Tran
  • 6,807
  • 6
  • 37
  • 54