fork download
  1. #include<iostream>
  2. #include<cmath>
  3. #include<fstream>
  4. typedef double S1[5];
  5. using namespace std;
  6. double *getcreditcurve(double*);
  7.  
  8. int main()
  9. {
  10. // S1 C1, C2;
  11.  
  12. S1 C1 = { 0.0029, 0.0039, 0.0046, 0.0052, 0.0057 };
  13. S1 C2 = { 0.0020, 0.0050, 0.0060, 0.0070, 0.0080 };
  14.  
  15. typedef double *issuer;
  16. issuer I1 = getcreditcurve(C1);
  17. issuer I2 = getcreditcurve(C2);
  18.  
  19.  
  20. ofstream print;
  21. print.open("result1.xls");
  22. print << I1+1 << '\t' << I2+2 << endl;
  23. print.close();
  24. return 0;
  25. }
  26.  
  27. double *getcreditcurve(double S1[5])
  28. {
  29. const int cp = 5;
  30. typedef double curve[cp];
  31. curve h;
  32.  
  33. h[0] = 2 * S1[0];
  34. h[1] = 3 * S1[1];
  35. h[2] = 4 * S1[2];
  36. h[3] = 5 * S1[3];
  37. h[4] = 6 * S1[4];
  38.  
  39. return h;
  40. }
Success #stdin #stdout 0s 3268KB
stdin
Standard input is empty
stdout
Standard output is empty