Question: Your task in this homework assignment is to define two functions that demonstrate certain tasks with C strings. Solution Specifications The functions will take two

Your task in this homework assignment is to define two functions that demonstrate certain tasks with C strings.

Solution Specifications

  • The functions will take two character arrays as parameters.
  • The first function, bool areAnagrams(const char[], const char[]), that reports whether the two c-strings are anagrams of each other. That is, each c-string has the same count of each (case-insensitive) letter (ignoring non-letters). For example, "Eleven plus two" is an anagram of "Twelve plus one."
  • The second function, bool arePalindromes(const char[], const char[]), that reports whether the two strings are palindromes of each other. Examples of palindromes are "A man, a plan, a canal, Panama!" and "Was it a car or a cat I saw?"

THIS IS MY CODE SO FAR...(using C++ programmming language)

#include

#include // cin & cout

#include

using namespace std;

bool areAnagrams(char string1[], char string2[]) {

// TODO Add code to determine if strings are anagrams

int n1 = strlen(string1);

int n2 = strlen(string2);

if (n1 != n2){

return false;

}

strcmp(string1, string2);

}

bool arePalindromes(char string1[], char string2[]) {

// TODO Add code to determine if strings 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!