Question: C++ PLEASE Write a program called a07.cpp that tests whether two words are anagrams (permutations of the same letters). Use strings or char arrays to

C++ PLEASE

  1. Write a program called a07.cpp that tests whether two words are anagrams (permutations of the same letters).

  2. Use strings or char arrays to read the 2 words.

  3. Use an int array of 26 characters (for the 26 letters from a to z) to keep count of the occurrence of each letter. Use 2 such int arrays, one for each word.

  4. Pass the string, and the array to a function that will count the occurence of the letters. Here is a prototype:

void occurrence(string word, int count[]);

  1. Now, pass the second word and the second int array to the same function in step 4.

  2. Now, you will have 2 int arrays that are populated with letter counts.

  3. Then pass the 2 count arrays to equal_array function that will return true if the words are anagrams and false otherwise. Here is a prototype:

bool equal_array(int count1[26], int count2[26]);

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!