Everytime i try to debug the loop in FindMaxSalesIndex with break points it just starts at the beginning code of my main.cpp file and doesnt even get to Functions.cpp no matter how many times i step over. Any idea? I usually place the break points right next to "int FindMaxSalesIndex" and "return MaximunSales"
main.cpp(no breakpoints placed in this file but everytime i run it and press step over it jump right to the first like of code)
int main()
{
string titleoutput; //creates variable for output title by person
string titleinput; //creates variable for intput title by person
titleinput = "input.txt";
titleoutput = "output.txt";
//cin >> titleinput; //creates a title
//cin >> titleoutput; // creates a title
string FirstName[5], LastName[5]; //declares 2 arrays
double Sales[5]; //delcares double array for sales
int ArraySize = 5; //delcares array number
ReadSalesFromFile(titleinput, FirstName, LastName, Sales); //uses function to set first name last name an sales into array from inputfile titleinput
SalesReport(titleoutput, FirstName, LastName, Sales, ArraySize);
return 0;
}
Functions.cpp (this is the file with the breakpoints)
void ReadSalesFromFile(string inputfilename, string firstname[], string lastname[], double Sales[])
{
ifstream InputFile; //delares variable for input data
InputFile.open(inputfilename); //assigns name for input data file to inputfilename from source.ccp
for (int i = 0; i < 5; i++)
{
InputFile >> firstname[i] >> lastname[i] >> Sales[i];
}
//sets first last and sales arrays with data from inputfilename
}
void SalesReport(string outputfilename, string firstname[], string lastname[], double Sales[], int ArraySize)//missing parameters
{
ofstream OutputFile; //sets output data file varible
OutputFile.open(outputfilename); //sets name for output variable
for (int i = 0; i <= 4; i++)
{
OutputFile << fixed << setprecision(2);
OutputFile << firstname[i] << setw(15) << lastname[i] << setw(20) << Sales[i] << "\n";//trying to set up data from inputfile to read out onto file
}
}
int FindMaxSalesIndex(double Sales[], int ArraySize, double &MaximunSales)
{
for (int x = 0; x <5; x++)
{
if (Sales[x] > MaximunSales)
{
MaximunSales = Sales[x];
ArraySize = x;
}
}
return MaximunSales;
}