I need to have it sorted in the add function by alphabetical order. (not using vectors). so say the input is c a b then output would be a b c. right not it outputs in the same order as input. im using puTTY/unix compiler.
[code]
#include <iostream>
#include <string>
using namespace std;
const int SIZE=100;
class library
{
public:
library();//constructor
void add(string song);
void display();
private:
string title[SIZE];
int n;
};
library::library()
{
n=0;
}
void library::add(string song)
{
Though, it would be more efficient if a seperate function in the library class was created for sorting the elements in the string. Instead of sorting it every time another song is added, that function could be called right before displaying the songs.