I need to put the names entered by the user in alphabetical order. What are my variables to declare? Im wanting to use something like this in my code but do not know what my array is or anything. selection_sort(arr1, arrSize);
using namespace std;
int main ()
{
string temp;
int numStrings = 0, maxStrings = 40;
string names[maxStrings];
cout << "Enter Student using Last Name First (done to stop)" << endl;
getline(cin,temp);
while ((temp!="done") && (numStrings < maxStrings))
{
names[numStrings++] = temp;
cout << "Enter another student (or done)"<< endl;
getline(cin,temp);
}
for (int j = 0; j < numStrings; j++)
cout << j << " " << names[j] << endl;
//void selection_sort(int arr1[9], int size)
{
// int index, temp;
// for (int i = 0; i < size-1 ; i++ )
{
// index = i;
// for (int j = i+1; j < size ; j++)
{
// if (arr1[j] > arr1[index]) index = j;
}
// temp = arr1[index];
// arr1[index] = arr1[i];
// arr1[i] = temp;
system("pause");
return 0;
}