The array passed into the function will have 50 rows and 100 columns Write test
ID: 3696123 • Letter: T
Question
The array passed into the function will have 50 rows and 100 columns Write test code that thoroughly tests the function. The test code should use assertions. bool areIdentical(int a[], int b[], int len); Write a predicate function that checks whether two arrays are identical (contain exactly the same elements in the same order). A declaration of the function is shown above. The function returns true if the two arrays are identical; otherwise it returns false. Write test code that tests every statement in the function. Use assertions in your test code.Explanation / Answer
public:
static bool areIdentical(std::vector<int> &a, std::vector<int> &b);
//.cpp file code:
bool <missing_class_definition>::areIdentical(std::vector<int> &a, std::vector<int> &b)
{
for (int j = 0 ;j < a.size() ;j++)
{
if (count(a,a [j]) != count(b,a [j]))
{
return false;
}
}
for (int j = 0 ;j < b.size() ;j++)
{
if (count(a,b [j]) != count(b,b [j]))
{
return false;
}
}
return true;
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.