Convert javascript examples to nodejs.
This commit is contained in:
parent
dbf2b1fe94
commit
5da54ca435
48 changed files with 312 additions and 223 deletions
|
|
@ -1,23 +1,23 @@
|
|||
// Operator overloading example
|
||||
var example = require("./build/Release/example");
|
||||
|
||||
a = new example.Complex(2,3);
|
||||
b = new example.Complex(-5,10);
|
||||
|
||||
print ("a =" + a);
|
||||
print ("b =" + b);
|
||||
console.log ("a =" + a);
|
||||
console.log ("b =" + b);
|
||||
|
||||
c = a.plus(b);
|
||||
|
||||
print("c =" + c);
|
||||
print("a*b =" + a.times(b));
|
||||
print("a-c =" + a.minus(c));
|
||||
console.log("c =" + c);
|
||||
console.log("a*b =" + a.times(b));
|
||||
console.log("a-c =" + a.minus(c));
|
||||
|
||||
e = example.Complex.copy(a.minus(c));
|
||||
print("e =" + e);
|
||||
console.log("e =" + e);
|
||||
|
||||
// Big expression
|
||||
f = a.plus(b).times(c.plus(b.times(e))).plus(a.uminus());
|
||||
print("f =" + f);
|
||||
console.log("f =" + f);
|
||||
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue