Sorting Name Alphabetically

I am a beginner at C++ but this is a lab we have to do and I have no idea what libraries, algorithms, process on how to start this exercise, etc. Please help.

Design a program that allows the user to enter 20 names into a String array. Sort the array in ascending (alphabetical) order and display its contents.
Last edited on
I would Start with this:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <iostream>
#include <string>

using namespace std;
string Array[20];
int main()
{
cout << "Start Here and work off of me!" << endl;
for(int i=0; i<20; i++)
{
cout<<"Please Enter Name "<<i+1<<endl;
cin>>Array[i];  ///Asks user to enter The names
cout<<endl;
}
for(int i=0; i<20; i++)
{
cout<<"Name "<<i+1<<" is:"<<endl;
cout<<Array[i]<<endl;  ///Repeats The names
}
return 0;
}
Last edited on
Topic archived. No new replies allowed.