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
A square aluminum plate 5 mm thick and 200 mm on a side is heated while vertically suspended in quiescent air at 40C. (A) Determ
Kamila [148]

brainly.com/question/14000001

4 0
3 years ago
The end of a large tubular workpart is to be faced on a NC vertical boring mill. The part has an outside diameter of 38.0 in and
nata0808 [166]

Answer:

(a) the cutting time to complete the facing operation = 11.667mins

b) the cutting speeds and metal removal rates at the beginning= 12.89in³/min and end of the cut. = 8.143in³/min

Explanation:

check attached files below for answer.

5 0
3 years ago
How do u charge ur phone? :)
Pepsi [2]
With a phone charger.
7 0
2 years ago
Read 2 more answers
Hareem and Shahad are on a road trip to Florida. They pull over to get gas, and as you may know it is sold by the gallon in the
Alona [7]

Answer:

53.3

Explanation:

4×14=56

56÷1.05=53.3

4 0
3 years ago
A coral reef is in danger of being destroyed by a seaside construction project. Which of the following best relates to how an en
Wewaii [24]

Answer:Bio team

Explanation:

4 0
3 years ago
Other questions:
  • Define a function pyramid_volume with parameters base_length, base_width, and pyramid_height, that returns the volume of a pyram
    10·1 answer
  • A vehicle is moving at a velocity, v, given by v =12t - 3t2 ms-1. Use
    7·1 answer
  • Read a 4 character number. Output the result in in the following format, Input 9873, Output 3 *** 7 ******* 8 ******** 9 *******
    8·1 answer
  • You don't know which insert you have, and the inserts are different sizes, meaning the amount needed for a 1:3 ratio is differen
    13·1 answer
  • (30 pts) A simply supported beam with a span L=20 ft and cross sectional dimensions: b=14 in; h=20 in; d=17.5 in. is reinforced
    13·1 answer
  • True or False; If I was trying to find the Voltage of my computer, and I was given the Watts and Amps it uses, I would use Watt'
    8·1 answer
  • A thin 20-cm*20-cm flat plate is pulled at 1m/s horizontally through a 4-mm thick oil layer sandwiched between two stationary pl
    15·1 answer
  • While discussing the diagnosis of an EI system in which the crankshaft and camshaft sensor tests are satisfactory but a spark te
    13·1 answer
  • Which type of engineer is needed in the following scenario?
    8·2 answers
  • True or false for the 4 questions?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!