What you have to do is reading the values in a vector or something, and then sort the vector according to some logic, like the greater sale.
Code:
struct Data
{
   int depid;
   double sales; 

   Data():depid(0), sales(0) {}
};

bool is_lower(const Data& d1, const Data& d2)
{
  return d1.sales < d2.sales;
}

std::vector<Data> listData;

// ... 
while (! salesfile.eof() )
{
   Data data;
   salesfile >> data.depid >> data.sales;

   listData.push_back(data);
}

// ...

// and now sort the vector
std::sort(listData.begin(), listData.end(), is_lower);
For comparing floating point values, see this FAQ.