I am working out a function that merges two lists and returns a pointer to a third list which contains the merged lists. Can anyone help? Here is what I have thus far:
/STLList - use the list container of std library
#include <list>
#include <string>
#include <cstdio>
#include <iostream>
//declare three list of objects
using namespace std;
list <string> Anames;
list <string> BastroSigns;
list <string> MergedNamesSigns;
int main()
{
// input string
cout << "input data - name - input 0 to end" << endl;
while (true)
{
string name;
cin >> name;
if (( name.compare("x") == 0) || (name.compare ("x") == 0))
{
break;
}
Anames.push_back (name);
}
// sort list
Anames.sortedInsert ();
//display list A
cout << "output is: " << endl;
while (!Anames.empty())
{
// get first on list
string name = Anames.front();
cout << name<< endl;
// remove displayed name from list
Anames.pop_front();
}
/ input string
cout << "input data - astrological sign - input 0 to end" << endl;
while (true)
{
string sign;
cin >> sign;
if (( sign.compare("x") == 0) || (sign.compare ("x") == 0))
{
break;
}
sign.push_back (sign);
}
// sort list
BastroSigns.sortedInsert ();
//display list B
cout << "output is: " << endl;
while (!BastroSigns.empty())
{
// get first on list
string sign = BastroSign.front();
cout << sign<< endl;
// remove displayed sign from list
BastroSigns.pop_front();
}
createsortedList()
{
}
mergelists()
//someOperation
//someNewlist
//somepointer to someNewList
system ("PAUSE") ;
return 0;