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
Burn rate can be affected by: A. Variations in chamber pressure B. Variations in initial grain temperature C. Gas flow velocity
Digiron [165]

Answer: D) All of the above

Explanation:

Burn rate can be affected by all of the above reasons as, variation in chamber pressure because the pressure are dependence on the burn rate and temperature variation in initial gain can affect the rate of the chemical reactions and initial gain in the temperature increased the burning rate. As, gas flow velocity also influenced to increasing the burn rate as it flowing parallel to the surface burning. Burn rate is also known as erosive burning because of the variation in flow velocity and chamber pressure.

4 0
4 years ago
An incremental encoder is rotating at 15 rpm. On the wheel there are 40 holes. How many degrees of rotation would 1 pulse be?
elena-s [515]

Answer:

1 pulse rotate = 9 degree

Explanation:

given data

incremental encoder rotating = 15 rpm

wheel holes = 40

solution

we get here first 1 revolution time

as 15 revolution take = 60 second

so 1 revolution take = \frac{60}{15}

1 revolution take = 4 seconds

and

40 pulse are there for 1 revolution

40 pulse for 360 degree

so 1 pulse rotate is = \frac{360}{40}

1 pulse rotate = 9 degree

3 0
3 years ago
What is the difference between class 1 and class 3 lever?
OlgaM077 [116]
In a Class Three Lever, the Force is between the Load and the Fulcrum. If the Force is closer to the Load, it would be easier to lift and a mechanical advantage. Examples are shovels, fishing rods, human arms and legs, tweezers, and ice tongs. A fishing rod is an example of a Class Three Lever.
6 0
3 years ago
Read 2 more answers
Assume that each atom is a hard sphere with the surface of each atom in contact with the surface of its nearest neighbor. Determ
deff fn [24]

Answer:

The classification of the concern is listed in the interpretation segment below.

Explanation:

(a)...

<u>Simple cubic lattice</u>

<u />a=2r

Now,

The unit cell volume will be:

=a^3

=(2r)^3

=8r^3

At one atom per cell, atom volume will be:

=(1)\times (\frac{4 \pi r^3}{3})

Then the ratio will be:

Ratio=\frac{\frac{4 \pi r^3}{3}}{8r^3}\times 100 \ percent

        =52.4 \ percent

(b)...

<u>Diamond lattice</u>

The body diagonal will be:

d=8r=a\sqrt{3}

       a=\frac{8}{\sqrt{3}}r

The unit cell volume will be:

=a^1

=(\frac{8r}{\sqrt{3}})^1

At eight atom per cell, the atom volume will be:

=8(\frac{4 \pi r^1}{3})

Then the Ratio will be:

Ratio=\frac{8(\frac{4 \pi r^1}{3})}{(\frac{8r}{\sqrt{3}})^1}\times 100 \ percent

        =34 \ percent

Note: percent = %

5 0
3 years ago
1.-¿Cómo actuaba el virus Miguel Ángel?
Black_prince [1.1K]
I don’t know so sorry about that
4 0
3 years ago
Other questions:
  • As a newly hired professional engineer your an executive with the firm strongly suggests that you attend a monthly dinner party
    8·1 answer
  • Given a two-dimensional steady inviscid air flow field with no body forces described by the velocity field given below. Assuming
    8·1 answer
  • A signal containing both a 5k Hz and a 10k Hz component is passed through a low-pass filter with a cutoff frequency of 4k Hz. Wh
    9·1 answer
  • Two resistors, with resistances R1 and R2, are connected in series. R1 is normally distributed with mean 65 and standard deviati
    12·1 answer
  • If you are interested only in the temperature range of 20° to 40°C and the ADC has a 0 to 3V input range, design a signal condit
    10·1 answer
  • A three-phase transformer connection has a delta-connected secondary, and one of the transformers has been center-tapped to form
    10·1 answer
  • If the specific surface energy for magnesium oxide is 1.0 J/m2 and its modulus of elasticity is (225 GPa), compute the critical
    7·1 answer
  • Select the correct answer.
    8·1 answer
  • Question #7
    8·1 answer
  • a crawler tractor is operated by a 180-hp diesel engine. calculate the probable gallons of fuel consumed per hr for each of the
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!