I need a break function to end the loop of inputting my text not for std::sort and Albert was talking about how I was sorting it as a vecor of ints instead of a vector of strings. I asked since I was using StringArray that I would need to have them input as as int's instead of strings. Here is my code now so you can see what I mean.
Code:
#include <iostream>
#include <string>
#include <fstream>
#include <iomanip>
#include <algorithm>
#include <vector>
using namespace std;
typedef std::vector <std::string> StringArray;
int main()
{
cout << "This program is a database for storing information." << endl;
ofstream myfile;
myfile. open ("data.txt", ios::app);
cout << "Please input what you want to store." << endl;
StringArray s;
std::string inString;
for (int i = 0; i < 5; i++ )
s.push_back(inString);
{
getline (cin, inString);
myfile << inString << endl;
}
std::sort (s.begin(), s.end(), greater<int>());
myfile. close ();
system("pause");
return 0;
}