1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
|
void oLokumRates(int, int, int, bool, char[]);
int main(void){
oLokumRates(1, Duration, 1, FALSE, "LokumTest.csv");
return 0;
}
void oLokumRates(int tot_scen, int dur_periods, int x1, bool rw_switch, char *charname) //tot_scen = Total Scenarios, zz = Duration, x1 = file number appended
{
//Check the projected rates here...
int k, i, j;
FILE *infile;
char temp_name[1000];
char buf[12];
_itoa_s(x1, buf, 10);
strcpy_s(temp_name, cRunLocation);
strcat_s(temp_name, charname);
strcat_s(temp_name, buf);
strcat_s(temp_name, ".csv");
errno_t err;
err = fopen_s(&infile, temp_name, "w");
if (infile == NULL) { exit(0); }
fputs("iteration,period,short_rate,nom_rate_5yr,nom_rate_10yr,beta,S&P_return,Bond_return,Russell_return,EAFE_return,Money_return\n", infile);
for (i = 1; i <= tot_scen; i++)
{
for (j = 0; j <= dur_periods; j++) //seperate phlvic, plic 05152009
{
fprintf_s(infile, "%d,", i);
fprintf_s(infile, "%d,", j);
if (rw_switch == TRUE)
{//LokumFIXED
}
else
{
fprintf_s(infile, "%.12lf,", LokumFIXED[i][j]);
fprintf_s(infile, "%.12lf,", LokumRate5[i][j]);
fprintf_s(infile, "%.12lf,", LokumUST7[i][j]);
fprintf_s(infile, "%.12lf,", LokumBeta[i][j]);
fprintf_s(infile, "%.12lf,", LokumUS[i][j]);
fprintf_s(infile, "%.12lf,", LokumAGGR[i][j]);
fprintf_s(infile, "%.12lf,", LokumSMALL[i][j]);
fprintf_s(infile, "%.12lf,", LokumINTL[i][j]);
fprintf_s(infile, "%.12lf", LokumMONEY[i][j]);
}
fputs("\n", infile);
}
}
fclose(infile);//Close File
}
|