On 15 =DAn, 05:12, "Gerry Ford" <inva...@[EMAIL PROTECTED]
> wrote:
> I just busted out my c++ reference from purgatory and find that it
doesn't=
> help my question at hand, concerning the inner product of vectors.
'vecto=
r'
> is not in the index.
>
> The programs in this reference are of the form void(main), so I'm left
to
> find a better syntax on the net. Since I want vectors and I want
output, =
I
> would assume that I have at least the following gheasders:
> #include <iostream.h>
> #include <vectors.h>
>
> I don't need anything off the command line, so I think that
> int main (void) { return 0; }
> is right. ??
>
> I'm given to understand that many of fortran's vector capabilities have
an=
> analog in c++. How would I declare and print a single four_vector, with
> double-wide real entries. For the purpose of illustration, let's make
the=
> ith entry the real square root of i:
> 0.0000..
> 1.0000...
> 1.414....
> 1.732..
>
> Since we're taking roots, we'll have to include math.h as well. How
does
> one declare such a vector ****tably?
>
> --
> Gerry Ford
>
> "The apple was really a peach."
> -- Allison Dunn on the garden of eden
You should include headers from standard library without .h:
#include <vector>
#include <iostream>
Some C-headers were adopted to C++, for example math.h is used in C++
as
#include <cmath>
(But both work with small differencies.)
For dot product you can #include <numeric> and use
std::inner_product(vector1.begin(), vector1.end(), vector2.begin(),
0);


|