#include "VectorCpx.h"
#include <fstream>
using namespace std;
fstream file("outVec.txt", ios::out);
void outVec(const VectorCpx& v){
file << "Size: " << v.size() << ", Capacity: " << v.capacity() << endl;
file << v;
}
int main(){
VectorCpx v1;
VectorCpx v2(5, Complex(1.234, 5.678));
VectorCpx v3 = v2;
file << "--------- A --------" << endl;
file << v1 << v2 << v3;
v2[2].real(9.87);
v3[-1].real(0);
v3[100].imag(999);
file << "--------- B --------" << endl;
outVec(v1); outVec(v2); outVec(v3);
file << "v2*v3=" << v2 * v3 << endl;
v1.resize(10);
file << v1;
/*v2.resize(8, Complex(0.1, 0.5));
v3.resize(3);
file << "--------- C --------" << endl;
outVec(v1); outVec(v2); outVec(v3);
file << "v2*v3=" << v2 * v3 << endl;*/
/*
v1.resize(2);
v3 = v1;
file << "--------- D --------" << endl;
outVec(v1); outVec(v2); outVec(v3);
v3[0] = v2[0];
v3[1] = v2[2];
v2.push_back(Complex(0.8051, 0.9801));
v3.push_back(Complex(0.5566, 0.9527)).push_back(Complex(0.2, 0.3));
file << "--------- E --------" << endl;
outVec(v1); outVec(v2); outVec(v3);
file << "v2*v3=" << v2 * v3 << endl;
v1 = v3 * Complex(2.0);
v2 = Complex(3.0, 4.0) * v3;
file << "--------- F --------" << endl;
outVec(v1); outVec(v2); outVec(v3);
*/
file.close();
}
I2luY2x1ZGUgIlZlY3RvckNweC5oIgojaW5jbHVkZSA8ZnN0cmVhbT4KdXNpbmcgbmFtZXNwYWNlIHN0ZDsKCmZzdHJlYW0gZmlsZSgib3V0VmVjLnR4dCIsIGlvczo6b3V0KTsKCnZvaWQgb3V0VmVjKGNvbnN0IFZlY3RvckNweCYgdil7CiAgICBmaWxlIDw8ICJTaXplOiAiIDw8IHYuc2l6ZSgpIDw8ICIsIENhcGFjaXR5OiAiIDw8IHYuY2FwYWNpdHkoKSA8PCBlbmRsOwogICAgZmlsZSA8PCB2Owp9CgppbnQgbWFpbigpewogICAgVmVjdG9yQ3B4IHYxOwogICAgVmVjdG9y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