help on mingle function

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • xx1level1xx
    New Member
    • Nov 2006
    • 4

    help on mingle function

    How would i make the following function???? confused

    int mingle(const string a1[], int n1, const string a2[], int n2,
    string result[], int max);
    If a1 has n1 elements in nondecreasing order, and a2 has n2 elements in nondecreasing order, place in result all the elements of a1 and a2, arranged in nondecreasing order, and return the number of elements so placed. Return -1 if the result would have more than max elements or if a1 and/or a2 are not in nondecreasing order. For example,

    string x[4] = { "brian", "lois", "lois", "peter" };
    string y[4] = { "chris", "lois", "meg", "stewie" };
    string z[10];
    int n = mingle(x, 4, y, 4, z, 10); // returns 8
    // z has brian chris lois lois lois meg peter stewie
Working...