How would I alphabetize this with the different strings? Would I just need to use a bubble sort?
Code:#include <iostream> #include <string> #include <fstream> #include <iomanip> using namespace std; int main() { string my_string; cout << "This program is a database for storing information." << endl; ofstream myfile; myfile. open ("data.txt", ios::app); string x; string y; string z; string a; string b; getline (cin, x); myfile << x << endl; getline (cin, y); myfile << y << endl; getline (cin, a); myfile << a << endl; getline (cin, b); myfile << b << endl; myfile. close (); system("pause"); return 0; }




Reply With Quote