Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

ANAGRAM.CPP Write a function in c++ that determines if two strings are anagrams. The function should not be case sensitive and should disregard any punctuation

ANAGRAM.CPP

Write a function in c++ 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. You may use either the string class or a C-style string. Either way, you may not use built-in C++ functions that we have NOT discussed in lecture.

Write a program in C++ that inputs two strings and calls your function to determine whether or not the strings are anagrams and prints the result.

REQUIRED: You MUST use strings to write this program. You may not use any C++ functions that we have NOT discussed in lecture. The program should print a string of text to the terminal before getting each line of input from the user. Try to use more simple functions.

A session should look EXACTLY like one of the following examples (including whitespace and formatting), with possibly different numbers and numbers of asterisks in the output:

Enter first string: Eleven plus two Enter second string: Twelve plus three The strings are not anagrams. 

OR

Enter first string: Rats and Mice Enter second string: in cat's dream The strings are anagrams. 

The strings printed by the program should include a newline at the end, but no other trailing whitespace (whitespace at the end of the line).

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

More Books

Students also viewed these Databases questions

Question

=+2 How does the preparation and support for each type of IE vary?

Answered: 1 week ago

Question

=+What is the extent of the use of each type of IE?

Answered: 1 week ago