|
/*
This is intended to be a small test program. It demonstrates
some of the functionality of the class template EVector.
*/
#include "EVector.h"
#include <algorithm>
using namespace std;
int main(int argc, char** argv)
{
// The default c-tor creates an invalid vector.
EVector<float, 4> v;
cout << "isValid = " << v.isValid() << endl
<< "Filling the vector with: ";
float n = 0;
cin >> n;
v.fill(n);
cout << "Now the vector = " << v << endl
<< "isValid = " << v.isValid() << endl
<< "Length = " << v.length() << endl;
cout << "Enter a vector of size " << v.size() << ": " << endl;
EVector<float, 4> u;
for (EVector<float, 4>::size_type i = 0; i < u.size(); ++i)
{
cout << '[' << i << "]: ";
cin >> n;
u[i] = n;
}
cout << "v*u = " << v*u << endl
<< "v is " << (v.isOrthogonal(u) ? "" : "not ") << "orthogonal to u" << endl;
reverse(u.begin(), u.end());
cout << "u reversed = " << u << endl;
cout << "Find if u contains the number: ";
cin >> n;
cout << (find(u.begin(), u.end(), n) == u.end() ? "Not found" : "Found") << endl;
return 0;
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.