#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);
    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));    //這裡很謎，如果寫v3.push_back(Complex(0.5566, 0.9527)).push_back(Complex(0.2, 0.3))會讀不到後面那個，拆開卻沒事
	v3.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();
}
