Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write C++ a function that determines if two strings are anagrams. The function should not be case sensitive and should disregard any punctuation or spaces.

Write C++ a function that determines if two strings are anagrams. The function should not be case sensitive and should disregard any punctuation or spaces. Two strings are anagrams if the letters can be rearranged to form each other. For example, Eleven plus two is an anagram of Twelve plus one. Each string contains one v, three es, two ls, etc Test your function with several strings that are anagrams and non-anagrams. You may use either the string class or a C-style string.

Hint: Count the number of each letter for the two strings and compare the two histograms.

Hint: Use an array of size 26 for the histogram.

Sample output (bolded text denote input from user)

Enter two strings.

eleven plus two

twelve plus one

They are anagrams!

Enter two strings.

Go Pokes

Go Sooners

They are not anagrams.

Note: Your program must compile, Make sure that you are submitting your source code not only the excecutible file

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Databases A Tour

Authors: Shashi Shekhar, Sanjay Chawla

1st Edition

0130174807, 978-0130174802

More Books

Students also viewed these Databases questions

Question

What is the primary purpose of the USA PATRIOT Act?

Answered: 1 week ago

Question

9. My life has no clear purpose.

Answered: 1 week ago

Question

What is the Definition for Third Normal Form?

Answered: 1 week ago

Question

Provide two examples of a One-To-Many relationship.

Answered: 1 week ago