Need Sorting Help

So I need to read in a .txt file and sort it by SSN in ascending order. No idea how to start this but here's what I have so far:

#include <iostream>
#include <fstream>
#include <string>

using namespace std;

struct Information
{
char name[25];
long SSN;
int age;
string address;
}Person;

int main()
{
string line;
ifstream Info ("a1.txt");
if (Info.is_open())
{
while (getline(Info,line))
{
cout << line << '\n';
}
Info.close();
}

char c;
cout << '\n' << "Add additional person? (y or n) ";
cin >> c;
while (c=='y' || c=='Y')
{
cout << '\n' << "Input Name (Last,First): ";
cin >> Person.name;
cout << '\n' << "Input SSN: ";
cin >> Person.SSN;
cout << '\n' << "Input Age: ";
cin >> Person.age;
cout << '\n' <<"Input Address: ";
cin.ignore();
getline(cin, Person.address);

cout << '\n' << Person.name;
cout << '\n' << Person.SSN;
cout << '\n' << Person.age;
cout << '\n' << Person.address << '\n';

cout << '\n' << "Add additional person? (y or n) ";
cin >> c;
}
ofstream NewInfo ("a1.txt", ios::ate | ios::app);
NewInfo << '\n' <<'\n' << Person.name;
NewInfo << '\n' << Person.SSN;
NewInfo << '\n' << Person.age;
NewInfo << '\n' << Person.address;
NewInfo.close();

//Sorting

return 0;
}

also here is the contents of the .txt file:

Matthews,Jocob
459237148
19
3930 4th Blvd, Yourcity, NJ 88710

Garfield,Kitty
891772436
24
36 Jon Havey Court, Middle, MO 66222

Lake,Bill
223390100
32
21 Ritts, Middletown, MI 48788

Johnson,Jim
567218923
22
100 Lakeview Road, Youngstown, MI 48932

Zumistan,Kim
675098667
25
76 Pond Street, New Brunswick, NJ 31900

April,Joe
312033387
21
126 Freelane, Yourtown, State 88990
Step 0: You need to use code tags:
http://www.cplusplus.com/articles/jEywvCM9/

Step 1: You need to be storing your Persons in a container, like std::vector:
http://www.cplusplus.com/reference/vector/vector/
http://en.cppreference.com/w/cpp/container/vector

Step 2: You need to use the third parameter of std::sort:
http://www.cplusplus.com/reference/algorithm/sort/
http://en.cppreference.com/w/cpp/algorithm/sort
But as for how to use it, we need to know whether your compiler supports C++11.
Topic archived. No new replies allowed.