The isPalindrome function from Example 6-6 has been included below for your convenience.

C++ Programming: From Problem Analysis to Program Design
8th Edition
ISBN:9781337102087
Author:D. S. Malik
Publisher:D. S. Malik
Chapter15: Recursion
Section: Chapter Questions
Problem 6PE
icon
Related questions
Question

Need help writing this program. **See attachment

QUICY DIG ignored, maths, upportate and TOMCICOUC
letters are considered the same.
The isPalindrome function from Example 6-6 has
been included below for your convenience.
bool isPalindrome (string str)
{
int length = str.length();
for (int i = 0; i < length / 2; i++) {
if (str[i] != str[length - 1 - i]) {
return false;
} // if
} // for loop
return true;
}//isPalindrome
A
Your program should print a message indicating if a string
is a palindrome:
madam is a palindrome
723456
1 #include
3 using na
5 int main
// Wr
retur
7
8}
Transcribed Image Text:QUICY DIG ignored, maths, upportate and TOMCICOUC letters are considered the same. The isPalindrome function from Example 6-6 has been included below for your convenience. bool isPalindrome (string str) { int length = str.length(); for (int i = 0; i < length / 2; i++) { if (str[i] != str[length - 1 - i]) { return false; } // if } // for loop return true; }//isPalindrome A Your program should print a message indicating if a string is a palindrome: madam is a palindrome 723456 1 #include 3 using na 5 int main // Wr retur 7 8}
Instructions
Write a program that uses the function isPalindrome
given in Example 6-6 (Palindrome). Test your program on
the following strings:
madam, abba, 22, 67876, 444244, rymeuemyrt
Modify the function isPalindrome of Example 6-6 so
that when determining whether a string is a palindrome.
cases are ignored, that is, uppercase and lowercase
letters are considered the same.
The isPalindrome function from Example 6-6 has
been included below for your convenience.
1 #include <i
2
3 using namesp
4
5 int main() {
6
// Write
7
return 0
8}
Transcribed Image Text:Instructions Write a program that uses the function isPalindrome given in Example 6-6 (Palindrome). Test your program on the following strings: madam, abba, 22, 67876, 444244, rymeuemyrt Modify the function isPalindrome of Example 6-6 so that when determining whether a string is a palindrome. cases are ignored, that is, uppercase and lowercase letters are considered the same. The isPalindrome function from Example 6-6 has been included below for your convenience. 1 #include <i 2 3 using namesp 4 5 int main() { 6 // Write 7 return 0 8}
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 4 steps with 4 images

Blurred answer
Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question

The lab values still require that I have the following string patterns in my lab:

.+*isPalindrome\(\"Madam\"\).+*

.+*isPalindrome\(\"abBa\"\).+*

.+*isPalindrome\(\"22\"\).+*

.+*isPalindrome\(\"67876\"\).+*

.+*isPalindrome\(\"444244\"\).+*

.+*isPalindrome\(\"trYmeuemyRT\"\).+*

MindTap - Cengage Learning - Microsoft Edge
https://ng.cengage.com/static/nb/ui/evo/index.html?deploymentid=57811235846758605217
»
O
T
F
Programming Exercise 6-1
!!!!
....
☆
CENGAGE MINDTAP
go
Tasks
Code Pattern. Complete
Uses function isPalindrome'
Code Pattern Incomplete
Tested isPalindrome with the
"Madam" string argument
Description
Searched your code for a specific
pattern:
.+*isPalindrome\(\"Madam\"\).+*
You can learn more about regular
expressions here.
Code Pattern Incomplete
Tested isPalindrome with the
"abBa" string argument
Description
Searched your code for a specific
pattern:
Type here to search
Run Checks
Submit 0%
O
C
Answere
Transcribed Image Text:MindTap - Cengage Learning - Microsoft Edge https://ng.cengage.com/static/nb/ui/evo/index.html?deploymentid=57811235846758605217 » O T F Programming Exercise 6-1 !!!! .... ☆ CENGAGE MINDTAP go Tasks Code Pattern. Complete Uses function isPalindrome' Code Pattern Incomplete Tested isPalindrome with the "Madam" string argument Description Searched your code for a specific pattern: .+*isPalindrome\(\"Madam\"\).+* You can learn more about regular expressions here. Code Pattern Incomplete Tested isPalindrome with the "abBa" string argument Description Searched your code for a specific pattern: Type here to search Run Checks Submit 0% O C Answere
Solution
Bartleby Expert
SEE SOLUTION
Follow-up Question

I appreciate your help. The program you suggested was correct but the task seems to be looking for certain code patterns for each palindrome

Code Pattern
Incomplete
Uses function is Palindrome
Description
Searched your code for a specific pattern:
\s\isPalindrome\(string str\)
You can learn more about regular expressio
Code Pattern Incomplete
Tested isPalindrome with the "Madam" string
argument
Description
Searched your code for a specific pattern:
+*isPalindrome (Madar).+*
You can learn more about regular expressio
Code Pattern incomplete
Tested isPalindrore with the abBa string
argument
Run checks
A
Jhy
7
9
12
92219
SE2823953
10
11
13
20
}
14 }
4 us
5 bc
6 {
15
16}
17 int
18 {
19
N34DO ONCO
str
"trym
int
for
{
}
if
со
el
cou
ret
Transcribed Image Text:Code Pattern Incomplete Uses function is Palindrome Description Searched your code for a specific pattern: \s\isPalindrome\(string str\) You can learn more about regular expressio Code Pattern Incomplete Tested isPalindrome with the "Madam" string argument Description Searched your code for a specific pattern: +*isPalindrome (Madar).+* You can learn more about regular expressio Code Pattern incomplete Tested isPalindrore with the abBa string argument Run checks A Jhy 7 9 12 92219 SE2823953 10 11 13 20 } 14 } 4 us 5 bc 6 { 15 16} 17 int 18 { 19 N34DO ONCO str "trym int for { } if со el cou ret
Y
Description
Searched your code for a specific pattern:
.+*isPalindrome\(\"Madam\"\).+*
You can learn more about regular expressio
Code Pattern Incomplete
Tested isPalindrome with the "abBa" string
argument
k
Description
Searched your code for a specific pattern:
.+*isPalindrome\(\"abBa\"\). +*
You can learn more about regular expressio
Code Pattern Incomplete
Tested isPalindrome with the "22" string argument
Description
Searched your code for a specific pattern
+*isPalindrome\(\"22\"\).-
Run checks
© Subm
1 #include <iost
2 #include <strin
3
4 using namespace
5 bool isPalinedr
ON
[2}
6 {
10
11
12
7
8
9
int length
for (int i=0;i
{
if (tolower(
{
}
return fal
14
15
16 }
17 int main()
18 {
10
}
return true;
string test[] =
"trymeuemyrt"};
int i;
for(i=0; i<6; i+
if(isPalinedrom
cout << test[i]
else
cout << test[i]
return 0;
Transcribed Image Text:Y Description Searched your code for a specific pattern: .+*isPalindrome\(\"Madam\"\).+* You can learn more about regular expressio Code Pattern Incomplete Tested isPalindrome with the "abBa" string argument k Description Searched your code for a specific pattern: .+*isPalindrome\(\"abBa\"\). +* You can learn more about regular expressio Code Pattern Incomplete Tested isPalindrome with the "22" string argument Description Searched your code for a specific pattern +*isPalindrome\(\"22\"\).- Run checks © Subm 1 #include <iost 2 #include <strin 3 4 using namespace 5 bool isPalinedr ON [2} 6 { 10 11 12 7 8 9 int length for (int i=0;i { if (tolower( { } return fal 14 15 16 } 17 int main() 18 { 10 } return true; string test[] = "trymeuemyrt"}; int i; for(i=0; i<6; i+ if(isPalinedrom cout << test[i] else cout << test[i] return 0;
Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning