Question: char* zigzagMerge(const char *s1, const char* s2) { /* create and return a new c-string by merging (putting in one) s1 and s2 in zigzag

char* zigzagMerge(const char *s1, const char* s2)

{

/* create and return a new c-string by merging (putting in one) s1 and s2 in zigzag form.

Example, zigzagMerge of "abc" and "defgh" will be "adbecfgh"

*/

}

bool isAnagram(const char *s1, const char* s2)

{ /* returns true if s1 and s2 contain same distinct characters apearing same number of times in both s1 and s2 otherwise returns false That is, this function returns true if s1 and s2 are permutations (re-arrangements) of same characters */ }

//Test zigzagMerge function

cout << endl;

char *s3 = zigzagMerge(s1, s2);

cout << "The zigzag merge of " << s1 << " and " << s2 << " is " << s3 << endl;

//Test isAnagram function

cout << endl;

char s4[] = "htsemsaesuatscs";

bool flag = isAnagram(s1, s4);

if (flag)

cout << s1 << " and " << s4 << " are anagrams" << endl;

else

cout << s1 << " and " << s4 << " are not anagrams" << endl;

Specifically, I am not allowed to include string, cstdlib or math libraries. Also, I am not allowed to use any built-in functions of c-strings.

here is the ideal output:

The zigzag merge of massachussettes and abmaachu is maabsmsaaacchhuussettes

massachussettes and htsemsaesuatscs are anagrams

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!