P
Pascal Steiss
Hi All
I'm new to C++.
I tried to write the following code:
<-- snip --
#include <cmath>
#include <iostream>
template < class K, class Y >
void NumerovIntegrate ( const K &k2, Y &y0, Y &y1, double &x0, double h,
unsigned int N ) {
<Y> y0_temp;
for (int i=1; i<=N; i++) {
y0_temp = y1;
y1 = 1/(1+h*h/12*sqr(k2(x0+2*h)))*(2*(1-5*h*h/12*sqr(k(x0+h)))*y1-(1
+h*h/12*sqr(k(x0)))*y0);
y0 = y0_temp;
x = x0+h;
}
}
-- snap --
G++ tells me:
-
pascal@thinkpad ~/rgp
$ g++ Numerov.cpp
Numerov.cpp: In function `void NumerovIntegrate(const K&, Y&, Y&,
double&,
double, unsigned int)':
Numerov.cpp:6: error: syntax error before `<' token
-
-
pascal@thinkpad ~/rgp
$ g++ -v
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/specs
Configured with: /GCC/gcc-3.3.1-3/configure --with-gcc --with-gnu-ld --
with-gnu-
as --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib
--libexe
cdir=/usr/sbin --mandir=/usr/share/man --infodir=/usr/share/info --
enable-langua
ges=c,ada,c++,f77,pascal,java,objc --enable-libgcj --enable-
threads=posix --with
-system-zlib --enable-nls --without-included-gettext --enable-
interpreter --enab
le-sjlj-exceptions --disable-version-specific-runtime-libs --enable-
shared --dis
able-win32-registry --enable-java-gc=boehm --disable-hash-
synchronization --verb
ose --target=i686-pc-cygwin --host=i686-pc-cygwin --build=i686-pc-cygwin
Thread model: posix
gcc version 3.3.1 (cygming special)
---
Can anyone help me please?
Thanks!
Pascal
I'm new to C++.
I tried to write the following code:
<-- snip --
#include <cmath>
#include <iostream>
template < class K, class Y >
void NumerovIntegrate ( const K &k2, Y &y0, Y &y1, double &x0, double h,
unsigned int N ) {
<Y> y0_temp;
for (int i=1; i<=N; i++) {
y0_temp = y1;
y1 = 1/(1+h*h/12*sqr(k2(x0+2*h)))*(2*(1-5*h*h/12*sqr(k(x0+h)))*y1-(1
+h*h/12*sqr(k(x0)))*y0);
y0 = y0_temp;
x = x0+h;
}
}
-- snap --
G++ tells me:
-
pascal@thinkpad ~/rgp
$ g++ Numerov.cpp
Numerov.cpp: In function `void NumerovIntegrate(const K&, Y&, Y&,
double&,
double, unsigned int)':
Numerov.cpp:6: error: syntax error before `<' token
-
-
pascal@thinkpad ~/rgp
$ g++ -v
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/specs
Configured with: /GCC/gcc-3.3.1-3/configure --with-gcc --with-gnu-ld --
with-gnu-
as --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib
--libexe
cdir=/usr/sbin --mandir=/usr/share/man --infodir=/usr/share/info --
enable-langua
ges=c,ada,c++,f77,pascal,java,objc --enable-libgcj --enable-
threads=posix --with
-system-zlib --enable-nls --without-included-gettext --enable-
interpreter --enab
le-sjlj-exceptions --disable-version-specific-runtime-libs --enable-
shared --dis
able-win32-registry --enable-java-gc=boehm --disable-hash-
synchronization --verb
ose --target=i686-pc-cygwin --host=i686-pc-cygwin --build=i686-pc-cygwin
Thread model: posix
gcc version 3.3.1 (cygming special)
---
Can anyone help me please?
Thanks!
Pascal