OK.
The compilation errors have to do with the BubbleSort function. For example, line 130
if(arrayToSort > arrayToSort[i + 1])
is unable to make this comparison because it's not comparing 2 elements of 'arrayToSort[]' but rather 1 element with the address of its pointer in memory which the compiler will flag as an error. I'm guessing u want this
if(arrayToSort[i] > arrayToSort[i + 1])
.
All of those arrayToSort need to be fixed similarly. Also, I'll point out that strings are typically not compared with > < operators. To sort things alphabetically, one idea is to find the ascii numeric values of the letters and then compare the numeric values of the first letters of 2 strings to see which is lower - if the letters are the same, test the 2nd letter of each and so on.
Given that ur input file is like this:
Acme Construction
Machinery design
Johnson Electrical |
Lines 30 and 34 are not going to work as u want. getline takes the full line and stores it into the string. So in this case,
element 0 of clients[count] will contain "Acme Construction"
element 0 of business[count] will contain "Machinery design"
element 1 of clients[count] will contain "Johnson Electrical"
To fix that u can have a 'parser' string to contain the whole line and then parse it and store it into the appropriate arrays. Another option is to use the insertion operator from ifstream >> like:
fin >> clients[count] >> business[count];
as many times as needed. This will only work as long as the input file is always exactly in the same format.