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
How many grams of perchloric acid, HClO4, are contained in 37.6 g of 70.5 wt% aqueous perchloric acid? How many grams of water a
kap26 [50]

Answer :

The mass of perchloric acid is, 26.5 grams.

The mass of water in the same solution is, 11.1 grams

Explanation :

As we are given that 70.5 wt % aqueous perchloric acid that means 70.5 grams of perchloric acid present in 100 grams of solution.

Now we have to determine the mass of perchloric acid in 37.6 grams of aqueous perchloric acid.

As, 100 grams of aqueous perchloric acid (solution) contains 70.5 grams of perchloric acid.

So, 37.6 grams of aqueous perchloric acid (solution) contains \frac{37.6}{100}\times 70.5=26.5 grams of perchloric acid.

Thus, the mass of perchloric acid is, 26.5 grams.

Now we have to determine the mass of water are in the same solution.

Total mass of solution = 37.6 g

Mass of perchloric acid = 26.5 g

Mass of water = Total mass of solution - Mass of perchloric acid

Mass of water = 37.6 g - 26.5 g

Mass of water = 11.1 g

Thus, the mass of water in the same solution is, 11.1 grams

4 0
4 years ago
What is the function of a regulator?
elena55 [62]
The function if I’m not correct just text me but 3
3 0
3 years ago
Everfi futuresmart module 6 retirement pie chart
Katarina [22]

Answer:

good luck

Explanation:

3 0
3 years ago
Read 2 more answers
A wooden pallet carrying 540kg rests on a wooden floor. (a) a forklift driver decides to push it without lifting it.what force m
kicyunya [14]

Answer:

The appropriate solution is "1481.76 N".

Explanation:

According to the question,

Mass,

m = 540 kg

Coefficient of static friction,

\mu_s = 0.28

Now,

The applied force will be:

⇒ F=\mu_s mg

By substituting the values, we get

       =0.28\times 540\times 9.8

       =1481.76 \ N

8 0
3 years ago
You can assume there is no pressure drop between the exit of the compressor and the entrance of the turbine. All the power from
Eddi Din [679]

Answer:

s6rt5x11j4fgu

j4

cf53yhu5

y4

hh

Explanation:

j

6 0
3 years ago
Other questions:
  • Researchers compared protein intake among three groups of postmenopausal women: (1) women eating a standard American diet (STD),
    14·1 answer
  • A 5 MW gas turbine power plant is reported to have a thermodynamic efficiency of 35%. Assume products of the combustion reaction
    5·1 answer
  • A closed system undergoes an adiabatic process during which the work transfer into the system is 12 kJ. The system then returns
    14·1 answer
  • A parallel circuit with two branches and an 18 volt battery. Resistor #1 on the first branch has a value of 220 ohms and resisto
    7·1 answer
  • Draw a flowchart to represent the logic of a program that allows the user to enter values for the current year and the user’s bi
    14·1 answer
  • Assume a steel pipe of inner radius r1= 20 mm and outer radius r2= 25 mm, which is exposed to natural convection at h = 50 W/m2.
    12·1 answer
  • Which statement concerning symbols used on plans is true?
    10·1 answer
  • Need help with these 3 ez questions pls help me will mark brainiest.
    15·1 answer
  • What is a beta testing ?
    15·2 answers
  • When bending metal, the material on the outside of the curve stretches while the material on the inside of the curve compresses.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!