annotate examples/standalone.cc @ 8203:a9da991c77aa

update contrib.txi
author John W. Eaton <jwe@octave.org>
date Wed, 08 Oct 2008 14:29:51 -0400
parents 804c60f92fb1
children 4295d634797d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
8097
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
1 #include <iostream>
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
2 #include <octave/oct.h>
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
3 int
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
4 main (void)
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
5 {
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
6 std::cout << "Hello Octave world!\n";
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
7 int n = 2;
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
8 Matrix a_matrix = Matrix (n, n);
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
9 for (octave_idx_type i = 0; i < n; i++)
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
10 {
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
11 for (octave_idx_type j = 0; j < n; j++)
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
12 {
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
13 a_matrix (i, j) = (i + 1) * 10 + (j + 1);
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
14 }
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
15 }
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
16 std::cout << a_matrix;
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
17 return 0;
804c60f92fb1 Add explanationation of initializing the interpreter in a standalone program
David Bateman <dbateman@free.fr>
parents:
diff changeset
18 }