Answered step by step
Verified Expert Solution
Question
1 Approved Answer
code in CPP with all details. Reflectional Symmetry of Strings [20 points] A string is said to be symmetric if its left and right halves
code in CPP with all details.
Reflectional Symmetry of Strings [20 points] A string is said to be symmetric if its left and right halves are mirror images of each other. If the string has an odd length, the middle character is cut in half. For example, the character "O" is symmetric because if we cut in in half across the middle, we get two halves that are mirror images of each other. The character "A" is also symmetric because curring the letter A in to a left and a right half, the two halves are mirror images of each other. The characters "G", and "E" are not symmetric. This is not an exhaustive list of all letters of the alphabet but you can see which upper case letters are symmetric and which are not. When it comes to strings of length 2, you again cut down the middle and check if the halves are mirror images. So the string "AA" is symmetric, the string "AI" is not. The following strings are all considered symmetric: "11", "25", "55", "3E", "9P", "JL", even though the symmetry is not perfect. Note: This exercise is concerned with upper case letters, and numbers only. No need to include lower case letters, and/or other symbols. More examples: "HELLO" - not symmetric "JOL" - symmetric "E83" - symmetric In your lab3.h file, include a function with the following signature: bool symmetric ( std::string ) which returns true if the given string is symmetric and false otherwise. You may use as many helper functions as you want. Reflectional Symmetry of Strings [20 points] A string is said to be symmetric if its left and right halves are mirror images of each other. If the string has an odd length, the middle character is cut in half. For example, the character "O" is symmetric because if we cut in in half across the middle, we get two halves that are mirror images of each other. The character "A" is also symmetric because curring the letter A in to a left and a right half, the two halves are mirror images of each other. The characters "G", and "E" are not symmetric. This is not an exhaustive list of all letters of the alphabet but you can see which upper case letters are symmetric and which are not. When it comes to strings of length 2, you again cut down the middle and check if the halves are mirror images. So the string "AA" is symmetric, the string "AI" is not. The following strings are all considered symmetric: "11", "25", "55", "3E", "9P", "JL", even though the symmetry is not perfect. Note: This exercise is concerned with upper case letters, and numbers only. No need to include lower case letters, and/or other symbols. More examples: "HELLO" - not symmetric "JOL" - symmetric "E83" - symmetric In your lab3.h file, include a function with the following signature: bool symmetric ( std::string ) which returns true if the given string is symmetric and false otherwise. You may use as many helper functions as you wantStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started