1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
MAXImum [283]
3 years ago
13

Write a program that uses the function isPalindrome given below. Test your program on the following strings: madam, abba, 22, 67

876, 444244, trymeuemyrt. Modify the function isPalindrome given so that when determining whether a string is a palindrome, cases are ignored, that is, uppercase and lowercase letters are considered the same. 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;
}

return true;
}
Engineering
1 answer:
defon3 years ago
5 0

Answer:

#include <iostream>

#include <string>

using namespace std;

bool isPalindrome(string str)

{

   int length = str.length();

   for (int i = 0; i < length / 2; i++)

   {

       if (tolower(str[i]) != tolower(str[length - 1 - i]))

           return false;

   }

   return true;

}

int main()

{

   string s[6] = {"madam", "abba", "22", "67876", "444244", "trymeuemyrt"};

   int i;

   for(i=0; i<6; i++)

   {

       //Testing function

       if(isPalindrome(s[i]))

       {

           cout << "\n " << s[i] << " is a palindrome... \n";

       }

       else

       {

           cout << "\n " << s[i] << " is not a palindrome... \n";

       }

   }    

       

   return 0;

}

You might be interested in
Given two alphabet strings str1 and str2. You can change the characters in str1 to any alphabet characters in order to transform
Keith_Richards [23]

Answer:

Explanation:

5

6 0
3 years ago
The cylinder C is being lifted using the cable and pulley system shown.
Sonja [21]

Answer:

sry but it's kinda hard

4 0
3 years ago
Which of the following is NOT a line used on blueprints?
jonny [76]

Answer: Photo lines

Explanation: made more sense

4 0
3 years ago
Select the right answer<br>​
Kruka [31]

Answer:

for 1st question the answer is 5th option.

for 2nd question the answer is 2nd option

hope it helps you mate

please mark me as brainliast

5 0
3 years ago
Water (density p-1000 is discharging from through a hole at the bottom of a graduated 71 cylinder. The mass flow rate exiting th
alexira [117]

Answer:

Please see attachment

Explanation:

Please see attachment

4 0
3 years ago
Other questions:
  • An 80-L vessel contains 4 kg of refrigerant-134a at a pressure of 160kPa. Determine (a) the temperature, (b) the quality, (c) th
    11·1 answer
  • Compared to arc welding, which of the following statements are true about<br> gas welding?
    13·1 answer
  • Can someone please do this for me? I’m so behind on other work for different classes and this one is due today! please I’d appre
    11·1 answer
  • Help me i need this bad :)
    14·1 answer
  • Why is communication one of the most important aspects of an engineer’s job?
    7·2 answers
  • If a nurse does not agree to the discipline set due to a complaint made against this nurse, after reviewing the proposed agreed
    14·1 answer
  • Explain the use of a vacuum gauge.
    15·1 answer
  • How does the Ivanpah Solar Plant make electricity?
    12·1 answer
  • The metric ruler is typically divided into
    6·2 answers
  • the left rear brake drum is scored, but the right rear drum looks as good as new. technician a says the left-side drum should be
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!