closed account (*Dy0fSL3A*)

Hey Ive been trying to work on this function for a while and cannot come up with where to start. Was wondering if anyone had any ideas

---------------------------------------------------------------------------------

int differ(const string a1[], int n1, const string a2[], int n2);

Return the position of the first corresponding elements of a1 and a2 that are not equal. n1 is the number of interesting elements in a1, and n2 is the number of interesting elements in a2. If the arrays are equal up to the point where one or both runs out, return the smaller of n1 and n2. For example,

string beings[6] = { "jarjar", "belle", "", "r2d2", "maleficent", "yoda" };

string group[4] = { "jarjar", "belle", "yoda", "aurora" };

int r = differ(beings, 6, group, 4); // returns 2

int s = differ(beings, 2, group, 1); // returns 1

---------------------------------------------------------------------------------

int differ(const string a1[], int n1, const string a2[], int n2);

Return the position of the first corresponding elements of a1 and a2 that are not equal. n1 is the number of interesting elements in a1, and n2 is the number of interesting elements in a2. If the arrays are equal up to the point where one or both runs out, return the smaller of n1 and n2. For example,

string beings[6] = { "jarjar", "belle", "", "r2d2", "maleficent", "yoda" };

string group[4] = { "jarjar", "belle", "yoda", "aurora" };

int r = differ(beings, 6, group, 4); // returns 2

int s = differ(beings, 2, group, 1); // returns 1

Topic archived. No new replies allowed.