Hi all,

I am trying to run the code below but I receive the following error message :

Debug Assertion Failed!

Program: C:\Test\Debug\Test.exe
File: c:\program files\microsoft visual studio 10.0\vc\include\vector
Line:932

Expression:vector subscript out of range
Thanks in advance for your help.

Code:
#include <fstream>
#include <cstdlib>
#include <iostream>
#include <strstream>
#include <cstring>
#include <cmath>
#include <map>
#include "Swap.h"
#define SIZE_X 100

void main()
{	
    cout.setf(ios::showpoint);
    cout.precision(8);

    cout << "Swap Pricing Pay Fixed  " << endl << endl;
    Date start = "3/29/2004";  
    cout << "Start date = " << start << endl;
    Date maturity = "3/28/2013";
    cout << "Maturity = " << maturity << endl;
    Date valuation = "10/14/2005"; //today";
    cout << "Valuation = " << valuation << endl;
    Date effectiveDate = "today";
    double notional = 3300000;
    cout << "Notional = " << notional << endl;
    double swapRate = 0.03969;
    cout << "Swap Rate = " << swapRate << endl;

    std::vector<double> mat;
    std::map<double,double> libor;
    std::map<double,double> discRate;
    char buffer[SIZE_X];
    char dataBuffer[SIZE_X];
    char* str = NULL;
    double yr = 0.0;
    double rate = 0.0;
    int swapType = 1;  // receive fixed-pay float ; 1 = pay fixed-receive float

    
    const char* file = "C:\WAR ROOM\FINANCE\Cpp\Test\Test\swapData.txt";
    ifstream fin;             // input file stream
    fin.clear();
    fin.open(file);
	
    if (fin.good())
    {
	while (!fin.eof())
	{
	    fin.getline(buffer,sizeof(buffer)/sizeof(buffer[0]));
	    //cout << buffer << endl;
	    istrstream str(buffer);
	    // Get data
	    str >> dataBuffer;
	    yr = atof(dataBuffer);

	    str >> dataBuffer;	
	    if (strcmp(dataBuffer,"MO") == 0)
		yr = (double) yr/12;
	    else if (strcmp(dataBuffer,"WK") == 0)
		yr = (double) yr/52;
	    else if (strcmp(dataBuffer,"DY") == 0)
		yr = (double) yr/365;
	    mat.push_back(yr);

	    str >> dataBuffer;
	    rate = atof(dataBuffer);
	    libor[yr] = rate;

	    str >> dataBuffer;
	    rate = atof(dataBuffer);
	    discRate[yr] = rate;
	}
     }
     else
	cout << "File not good!" << "\n";

     fin.close();

     Swap s(notional,maturity,start,start+1,valuation,libor,discRate,swapRate,swapType);
}