In LQ forums posts you can enclose code segments in the [CODE] tags, which will preserve formatting and use a fixed width font.
Minor note: main() should have params (int argc, char** argv), and should return an integer when it terminates.
OK, the actual problem: when you sort with this part:
Code:
while(name != " ")
sort(names.begin(), names.end());
How do you expect it to end the loop? The sort function will not modify the value of name, so the condition for the loop will never change - you have an infinite loop, that is why the program gets stuck.
Also, having two separate containers - one for the marks and one for the student names is risky - the orders of the two would easily get out of sync, and you would have no way to recover. It would be better to use a map<string, int> object to relate the student name to their mark.