File: e1.cpp

package info (click to toggle)
libmath%2B%2B 0.0.4-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 412 kB
  • ctags: 232
  • sloc: cpp: 1,311; makefile: 63; sh: 17
file content (27 lines) | stat: -rw-r--r-- 639 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27

#include <math++/nodes.h>
#include <math++/printer.h>

#include <iostream>
#include <memory>

int main() {
    std::cout << "Expression Manipulation example program (e1)" << std::endl;

    // 2 + 3 * 4
    std::auto_ptr<math::TNode<double> > e(
        new math::TPlusNode<double>(
            new math::TNumberNode<double>(2),
            new math::TMulNode<double>(
                new math::TNumberNode<double>(3),
                new math::TNumberNode<double>(4)
            )
        )
    );

    std::cout << "reproduction : ";
    math::TPrinter<double>::printOn(std::cout, e.get());
    std::cout << std::endl;

    return 0;
}