By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,750 Members | 1,214 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,750 IT Pros & Developers. It's quick & easy.

help on mingle function

P: 4
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
Nov 8 '06 #1
Share this question for a faster answer!
Share on Google+

Post your reply

Sign in to post your reply or Sign up for a free account.