Read from file, sort in array alphabetically, display array names and count of each name

Hey guys. I'm still pretty new to coding so I'm a little confused on where to go from here. So what I have is basically the code to open the text file, but I do not know the simplest way to put them in an array, sort them alphabetically, and show the total count of each name. Here's what I have so far.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
  #include<iostream>
#include<string>
#include<fstream>

using namespace std;	

int main()
{
const int names = 100;
int namesArray[names];
string name;
string firstNameInList;
string lastNameInList;
int count = 0;
string line_;

ifstream file_("Names.txt");

while (file_ >> name)
{
	if(count==0)
	{
		firstNameInList = name;
		lastNameInList = name;
		count++;
	}
	else
	{
		if(name < firstNameInList)
			firstNameInList = name;
		else if(name > lastNameInList)
			lastNameInList = name;
		
	}
	
}




if(file_.is_open())
{
while(getline(file_,line_))
{
	cout<<line_<< '\n';
}
file_.close();
cout << "First Name by alphabet is "<< firstNameInList << endl;
cout << "Last Name by alphabet is "<< lastNameInList << endl;
}
else 
cout<<"File is not open"<<endl;

}
What does the file "Names.txt" contain, and what should the output of the program look like?
The names.txt file contains 150 names, with at least 100 unique names. The output should display the first 100 unique names of the text file, with each name having a count of how many times each name was displayed.
What does a name in the file names.txt llok like?
Could Jorge Francisco Isidoro Luis Borges Acevedo be a single name present in the file?
Does the file contain one name per line of text?
Topic archived. No new replies allowed.