The user is going to type in three strings, but I need them to appear in alphabetical order. Why doesn't this work? void swap(string A, string B) { const string origA = A; A = B; B = origA; } void main() { cout << "Type three words or I'll break your leg. "; string X, Y, Z; cin >> X >> Y >> Z; cout << "You entered " << X << ", " << Y << ", " << Z << "\n"; if (X > Y) swap(X, Y); if (Y > Z) swap(Y, Z); if (X > Y) swap(X, Y); cout << "In order they are " << X << ", " << Y << ", " << Z << "\n"; } I need to redefine swap like this: void swap(string & A, string & B) { const string origA = A; A = B; B = origA; } Just those two little ampersands. They make A and B be REFERENCE PARAMETERS, which are just aliasses or redirections from the names A and B to the variables provided when swap was called. Without ampersands, C++ normally uses VALUE PARAMETERS, which are just temporary copies of the values provided when swap is called.