Here is my code...What would be the best way to sort names alphabetically?
#include #include #include using name
The standard way is to use std::sort:
std::sort
#include // ... std::sort(sname, sname + StudentNum);
std::sort uses operator< by default, which actually does an alphabetical comparison for strings.
operator<
EDIT: Indeed, it should be StudentNum instead of 25.
StudentNum