MindTap - Cengage Learning - Microsoft Edge A https://ng.cengage.com/static/nb/ui/evo/index.html?deploymentld=57811235846758605217306036&elSBN=9781337274715&id=710937854&snapshotld=1589550& >> CENGAGE MINDTAP Q Search this course Programming Exercise 6-1 Instructions main.cpp >- Terminal 1 #include main.cpp: In function 'int main ()': main.cpp:31:3: еггог: еxреcted primary-expression before ' t oken /s/.isPalindrome("Madam") > n 2 #include Instructions A-Z 4 using namespace std; Write a program that uses the function </> 6 //My user defined function that checks whether given string is palindrome 7 bool isPalindrome(string str) isPalindrome given in Example 6-6 main.cpp:31:6: еггог: еxpected primary-expression before .'t oken /s/.isPalindrome("Madam") > n (Palindrome). Test your program on the 8 { following strings: 9. //Finding the string length 10 int length = str.length(); 11 madam, abba, 22, 67876, 444244, trymeuemyi main.cpp:41:8: error: “i' was n ot declared in this scope for (i = 0; i < 6; i++) 12 //Iterating over string 13 for (int i = 0; i < length / 2; i++) 14 { /bin/bash: line 4: ./a.out: No such file or directory 15 //Converting both characters into lower-case and then comparing them, bongo Modify the function isPalindrome of //So now, the comparison function will ignore the case if (tolower(str[i]) != tolower(str[length - 1 - i])) { return false; 16 Example 6-6 so that when determining 17 whether a string is a palindrome, cases are 18 19 ignored, that is, uppercase and lowercase 20 } letters are considered the same. 21 //string is a palindrome 22 return true; The isPalindrome function from Example 23 6-6 has been included below for your 24 convenience. 25 //Define the main function 26 int main() bool isPalindrome(string str) 11:05 PM P Type here to search Answered: I have a .. MindTap - Cengag.. main.cpp - Notepad 4/10/2020

Np Ms Office 365/Excel 2016 I Ntermed
1st Edition
ISBN:9781337508841
Author:Carey
Publisher:Carey
Chapter6: Managing Multiple Worksheets And Workbooks
Section: Chapter Questions
Problem 2.12CP
icon
Related questions
Question
100%

I Hope you can understand that my programming needs.

Here's the instructions again for my C++ program:

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, trymeuemyrt

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.

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

Your program should print a
message indicating if a string is a
palindrome:

madam is a palindrome

Here's my code so far:

#include <iostream>
#include <string.h>

using namespace std;

//My user defined function that checks whether given string is palindrome
bool isPalindrome(string str)
{
//Finding the string length
int length = str.length();

//Iterating over string
for (int i = 0; i < length / 2; i++)
{
//Converting both characters into lower-case and then comparing them,
//So now, the comparison function will ignore the case
if (tolower(str[i]) != tolower(str[length - 1 - i])) {
return false;
}
}
//String is a palindrome
return true;
}

//Define the main function
int main()
{
//Array of strings

string s[7] = {"Madam", "22", "abBa", "67876", "444244", "trYmeuemyRT"};
/s/.isPalindrome("Madam") ~=> ~<MatchData "i">
/s/.isPalindrome("22") ~=> ~<MatchData "i">
/s/.isPalindrome("abBa") ~=> ~<MatchData "i">
/s/.isPalindrome("67876") ~=> ~<MatchData "i">
/s/.isPalindrome("444244") ~=> ~<MatchData "i">
/s/.isPalindrome("trYmeuemyRT") ~=> ~<MatchData "i">

int i;

//Checking five strings
for (i = 0; i < 6; i++)
{
//Testing the boolean isPalindrome user defined function against the string variables.
if (isPalindrome(s[i]))
{
cout << "\n " << s[i] << " is a palindrome";
}
else
{
cout << "\n " << s[i] << " is not a palindrome";
}

}
return 0;
}

I already get that if the following code is removed, the program will execute properly:

/s/.isPalindrome("Madam") ~=> ~<MatchData "i">
/s/.isPalindrome("22") ~=> ~<MatchData "i">
/s/.isPalindrome("abBa") ~=> ~<MatchData "i">
/s/.isPalindrome("67876") ~=> ~<MatchData "i">
/s/.isPalindrome("444244") ~=> ~<MatchData "i">
/s/.isPalindrome("trYmeuemyRT") ~=> ~<MatchData "i">

That's the problem! If I remove them, and execute the code, it will print out the desired output, but that will only account for 40% of the grade! I will still fail the lab miserably! The above code is required to have 100% completion, and that's my goal!

If you would humor me please, Please look at the screen shot I've sent along. According to the lab's complier, their are only 3 errors left to accomidate. I don't know how to fix these errors, but when they are fixed, I could run the program, and then get the full grade.

However, I'm not sure that I have inputted the correct regular expressions. According to the lab, I'm using the correct expressions, but I believe that in each line, the corresponding ~<MatchData "i"> isn't correct. Am I supposed to match it to s[7] in line 30, or should I match it to s[i] in line 44? If I'm right, please tell me how to code it right.

Also, as I said before, I'm not sure if these regular expressions should be placed here at lines 31-36, or if they should be placed somewhere else in the program. I'm concerned that the reason why I'm having so much trouble with this program is because of where I have inputted these expressions. That means if I'm right, the problem would be fixed quickly if they are placed in the correct location (if there is another location). Please help me! I'm desperate, and I can't spend another week fixing another program! I need help!

MindTap - Cengage Learning - Microsoft Edge
A https://ng.cengage.com/static/nb/ui/evo/index.html?deploymentld=57811235846758605217306036&elSBN=9781337274715&id=710937854&snapshotld=1589550&
>>
CENGAGE MINDTAP
Q Search this course
Programming Exercise 6-1
Instructions
main.cpp
>- Terminal
1 #include <iostream>
main.cpp: In function 'int main
()':
main.cpp:31:3: еггог: еxреcted
primary-expression before ' t
oken
/s/.isPalindrome("Madam")
> n<MatchData "i">
2 #include <string.h>
Instructions
A-Z
4 using namespace std;
Write a program that uses the function
</>
6 //My user defined function that checks whether given string is palindrome
7 bool isPalindrome(string str)
isPalindrome given in Example 6-6
main.cpp:31:6: еггог: еxpected
primary-expression before .'t
oken
/s/.isPalindrome("Madam")
> n<MatchData "i">
(Palindrome). Test your program on the
8 {
following strings:
9.
//Finding the string length
10
int length = str.length();
11
madam, abba, 22, 67876, 444244, trymeuemyi
main.cpp:41:8: error: “i' was n
ot declared in this scope
for (i = 0; i < 6; i++)
12
//Iterating over string
13
for (int i = 0; i < length / 2; i++)
14
{
/bin/bash: line 4: ./a.out: No
such file or directory
15
//Converting both characters into lower-case and then comparing them,
bongo
Modify the function isPalindrome of
//So now, the comparison function will ignore the case
if (tolower(str[i]) != tolower(str[length - 1 - i])) {
return false;
16
Example 6-6 so that when determining
17
whether a string is a palindrome, cases are
18
19
ignored, that is, uppercase and lowercase
20
}
letters are considered the same.
21
//string is a palindrome
22
return true;
The isPalindrome function from Example
23
6-6 has been included below for your
24
convenience.
25 //Define the main function
26 int main()
bool isPalindrome(string str)
11:05 PM
P Type here to search
Answered: I have a ..
MindTap - Cengag..
main.cpp - Notepad
4/10/2020
Transcribed Image Text:MindTap - Cengage Learning - Microsoft Edge A https://ng.cengage.com/static/nb/ui/evo/index.html?deploymentld=57811235846758605217306036&elSBN=9781337274715&id=710937854&snapshotld=1589550& >> CENGAGE MINDTAP Q Search this course Programming Exercise 6-1 Instructions main.cpp >- Terminal 1 #include <iostream> main.cpp: In function 'int main ()': main.cpp:31:3: еггог: еxреcted primary-expression before ' t oken /s/.isPalindrome("Madam") > n<MatchData "i"> 2 #include <string.h> Instructions A-Z 4 using namespace std; Write a program that uses the function </> 6 //My user defined function that checks whether given string is palindrome 7 bool isPalindrome(string str) isPalindrome given in Example 6-6 main.cpp:31:6: еггог: еxpected primary-expression before .'t oken /s/.isPalindrome("Madam") > n<MatchData "i"> (Palindrome). Test your program on the 8 { following strings: 9. //Finding the string length 10 int length = str.length(); 11 madam, abba, 22, 67876, 444244, trymeuemyi main.cpp:41:8: error: “i' was n ot declared in this scope for (i = 0; i < 6; i++) 12 //Iterating over string 13 for (int i = 0; i < length / 2; i++) 14 { /bin/bash: line 4: ./a.out: No such file or directory 15 //Converting both characters into lower-case and then comparing them, bongo Modify the function isPalindrome of //So now, the comparison function will ignore the case if (tolower(str[i]) != tolower(str[length - 1 - i])) { return false; 16 Example 6-6 so that when determining 17 whether a string is a palindrome, cases are 18 19 ignored, that is, uppercase and lowercase 20 } letters are considered the same. 21 //string is a palindrome 22 return true; The isPalindrome function from Example 23 6-6 has been included below for your 24 convenience. 25 //Define the main function 26 int main() bool isPalindrome(string str) 11:05 PM P Type here to search Answered: I have a .. MindTap - Cengag.. main.cpp - Notepad 4/10/2020
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Datatypes
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
Np Ms Office 365/Excel 2016 I Ntermed
Np Ms Office 365/Excel 2016 I Ntermed
Computer Science
ISBN:
9781337508841
Author:
Carey
Publisher:
Cengage

Expert Answers to Latest Homework Questions

Q: Teacher's ○ immediacy presence ○ involvement O caring refers to the verbal and nonverbal…
Q: = Let ā (9, 6, 1) and 6 = (-7, −3, 3). Compute the projection of a onto b and the vector component…
Q: Healthcare providers have historically addressed health care issues using a biomedical model of…
Q: One information processing strategy in which people from all cultures engage is ○ stereotyping O…
Q: Let a = (-3, 0, 4) and 6 = (0,4,-4). Find the projection of 5 onto ā. proj₁ = 25
Q: Let a = (-3, 0, 4) and 6 = (0,4,-4). Find the projection of 5 onto ā. proj₁ = 25
Q: In comparison with workers in the United States, Mexican workers are more preoccupied with their…
Q: The equations x² + y²+z² - 4z = 0 and x² - 14x + y²+16y+² = -104 represent spheres in three…
Q: The most prominent feature of German culture that permeates into their organizations is ○ low power…
Q: In Japanese companies, the primary purpose of taiso is to reward productive workers O punish less…
Q: Research in healthcare and culture has shown that in both collectivistic and individualistic…
Q: In comparison with U.S. managers, Japanese managers use influence tactics that are. ○ punishment…
Q: A physicist's left eye is myopic (i.e., nearsighted). This eye can see clearly only out to a…
Q: In 2015, this country surpassed the United States as the world's largest economy. France Japan China…
Q: According to Rosenzweig, U.S. managers often have difficulty learning to communicate effectively…
Q: Most Mexican businesses have ○ a decentralized structure incorporating participative management…
Q: An accommodating learning style is based on the combination of concrete experience and abstract…
Q: I need help with this assaigment  I need help writing a abstract about england Vs Saudi Arabia
Q: The Sun delivers an average power of 583.9 W/m2 to the top of Mars's atmosphere. Find the magnitudes…
Q: Question 12: Vertebrate stomach acid production provides an example of which of the following? 1.…
Q: Organizations in large power distance cultures will O employ top-down communication be unconcerned…