cout <<" Enter the name of the file: ";
cin>>filename;
convert(fp, filename);
fp.open("filename");
was probably meant to be (in case of present C++11 support):
cout << " Enter the name of the file: ";
cin >> filename;
fp.open(filename);
or (in C++03):
cout << " Enter the name of the file: ";
cin >> filename;
fp.open(filename.c_str());
Side note: Elements in an array are indexed from 0
to SIZE - 1
so when you declare:
float pay[SIZE];
then when you do:
pay[SIZE] = calcPay(rate, sum);
you are accessing memory "pass" the last element, which causes undefined behavior.