@rpdm read my post again, it's the implementation of the same algo.
And remember:

  1. chalson wanted to get the numbers as input, so you won't require the time() and srand() and the inclusion of header files and
  2. The values required are float, not integers.
  3. your main() should return a value.
rpdm commented: All bad points. Thanks for assuming I'm an idiot. +0

Can someone tell me the algorithm used by the functions sorted() and [list].sort()?

@above repliers with all regards...Sorry to say, but you must keep in mind the level of person when answering...
The above solutions are using STL which come a way ahead in programming in C++
A more simple way is to:
ifstream f;
char a[15];
The above code reads from the file a word of max length 15 and puts it into the string "a". The line: f>>a, tells the compiler to read from file till a white space is encountered.
For more info, go to:

Fbody commented: spammer +0
jonsca commented: C'mon +0