Thanks for the reply --> I didn't mean to sound flippant in not wanting to learn structs its just im still having trouble with arrays etc!
Here is what I have so far with notes. Sorry if I am missing something totally obvious but I am having a little trouble understanding your code. Thanks for you patience.
struct A{
public:
string amount, name;
booloperator<(const A&b) const;
} array[SIZE];
for (int n=0; n<SIZE; n++)
{array[n].amount=amounts[n]; // Fill the struct with the data from my arrays? Is this correct?
array[n].name=names[n];}
sort(array,array+SIZE); //This gives an error. Here I want to sort the NAMES ONLY and print their corresponding 'amount' together
ofstream outfile; //Printing to file
outfile.open ("outputalpha.txt");
for( int K=0; K<SIZE; K++)
outfile << array[K].amounts << ' ' << array[K].name << std::endl;
Your array is an array of struct A so you need to tell the sort function use which data member for sorting. Hence you need to provide a comparison function or functor to the sort.