Test all functionality
This commit is contained in:
parent
97a4d8e0ab
commit
263834ebe5
1 changed files with 39 additions and 21 deletions
60
vector.cpp
60
vector.cpp
|
@ -2,26 +2,44 @@
|
|||
#include <iostream>
|
||||
using namespace std;
|
||||
int main() {
|
||||
vector v = vector(3);
|
||||
cnumber one(1,0);
|
||||
cnumber two(2,0);
|
||||
cnumber three(3,0);
|
||||
cnumber four(4,0);
|
||||
cnumber five(5,0);
|
||||
cnumber i(0,1);
|
||||
v[0] = one;
|
||||
v[1] = two;
|
||||
v[2] = i;
|
||||
vector v = vector(3);
|
||||
cnumber one(1, 0);
|
||||
cnumber two(2, 0);
|
||||
cnumber three(3, 0);
|
||||
cnumber four(4, 0);
|
||||
cnumber five(5, 0);
|
||||
cnumber i(0, 1);
|
||||
v[0] = one;
|
||||
v[1] = two;
|
||||
v[2] = i;
|
||||
|
||||
vector w = vector(3);
|
||||
w[0] = three;
|
||||
w[1] = four;
|
||||
w[2] = five;
|
||||
cout << "v:" << endl;
|
||||
cout << v << endl;
|
||||
cout << "w:" << endl;
|
||||
cout << w << endl;
|
||||
cout << "v * w:" << endl;
|
||||
cout << v * w << endl;
|
||||
return 0;
|
||||
vector w = vector(3);
|
||||
w[0] = three;
|
||||
w[1] = four;
|
||||
w[2] = five;
|
||||
cout << "v:" << endl;
|
||||
cout << v << endl;
|
||||
cout << "w:" << endl;
|
||||
cout << w << endl;
|
||||
cout << "v + w:" << endl;
|
||||
cout << v + w << endl;
|
||||
cout << "v - w:" << endl;
|
||||
cout << v - w << endl;
|
||||
cout << "v * w:" << endl;
|
||||
cout << v * w << endl;
|
||||
cout << "w * i:" << endl;
|
||||
cout << w * i << endl;
|
||||
for (long long j = 0; j < v.get_dimention(); j++) {
|
||||
cout << "Element " << j << " of v:" << endl;
|
||||
cout << v[j] << endl;
|
||||
}
|
||||
cout << "A temp vector of dimension 3" << endl << vector(3) << endl ;
|
||||
vector k = vector(3);
|
||||
k = w;
|
||||
cout << "Assignment of w to k" << endl << k << endl ;
|
||||
cout << "Manually set elements of k to elements of v" << endl;
|
||||
for (long long j = 0; j < v.get_dimention(); j++)
|
||||
k[j] = v[j];
|
||||
cout << k << endl;
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue