fork download
  1. #include "VectorCpx.h"
  2. #include <fstream>
  3. using namespace std;
  4.  
  5. fstream file("outVec.txt", ios::out);
  6.  
  7. void outVec(const VectorCpx& v){
  8. file << "Size: " << v.size() << ", Capacity: " << v.capacity() << endl;
  9. file << v;
  10. }
  11.  
  12. int main(){
  13. VectorCpx v1;
  14. VectorCpx v2(5, Complex(1.234, 5.678));
  15. VectorCpx v3 = v2;
  16. file << "--------- A --------" << endl;
  17. file << v1 << v2 << v3;
  18.  
  19. v2[2].real(9.87);
  20. v3[-1].real(0);
  21. v3[100].imag(999);
  22. file << "--------- B --------" << endl;
  23. outVec(v1); outVec(v2); outVec(v3);
  24. file << "v2*v3=" << v2 * v3 << endl;
  25.  
  26. v1.resize(10);
  27. file << v1;
  28. /*v2.resize(8, Complex(0.1, 0.5));
  29.   v3.resize(3);
  30.   file << "--------- C --------" << endl;
  31.   outVec(v1); outVec(v2); outVec(v3);
  32.   file << "v2*v3=" << v2 * v3 << endl;*/
  33. /*
  34.   v1.resize(2);
  35.   v3 = v1;
  36.   file << "--------- D --------" << endl;
  37.   outVec(v1); outVec(v2); outVec(v3);
  38.  
  39.   v3[0] = v2[0];
  40.   v3[1] = v2[2];
  41.   v2.push_back(Complex(0.8051, 0.9801));
  42.   v3.push_back(Complex(0.5566, 0.9527)).push_back(Complex(0.2, 0.3));
  43.   file << "--------- E --------" << endl;
  44.   outVec(v1); outVec(v2); outVec(v3);
  45.   file << "v2*v3=" << v2 * v3 << endl;
  46.  
  47.   v1 = v3 * Complex(2.0);
  48.   v2 = Complex(3.0, 4.0) * v3;
  49.   file << "--------- F --------" << endl;
  50.   outVec(v1); outVec(v2); outVec(v3);
  51. */
  52. file.close();
  53. }
  54.  
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
prog.cpp:1:23: fatal error: VectorCpx.h: No such file or directory
compilation terminated.
stdout
Standard output is empty