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 ball thrown vertically upward from the top of a building of 60ft with an initial velocity of vA=35 ft/s. Determine (a) how hig
Masteriza [31]

Answer:

A.) 62.5 ft

B.) 3.58 seconds

C.) 8.58 seconds

Explanation:

A.) Given that a ball is thrown vertically upward from the top of a building of 60ft with an initial velocity of vA=35 ft/s

To determine how high above the top of the building the ball will go before it stops at B, let us use the third equation of motion.

V^2 = U^2 - 2gH

Since the ball is going up, g will be negative. And at maximum height, V = 0

Substitute all the parameters into the formula

0 = 35^2 - 2 × 9.8 × H

19.6H = 1225

H = 1225/19.6

H = 62.5 ft

(B) The time tAB it takes to reach its maximum height will be achieved by using second equation of motion

H = Ut - 1/2gt^2

Substitutes all the parameters into the formula

62.5 = 35t - 1/2 × 9.8 × t^2

62.5 = 35t - 4.9t^2

4.9t^2 - 35t + 62.5 = 0

Let's use quadratic equations to find t

Divide all by 4.9

t^2 - 7.143t + 12.755 = 0

t^2 - 7.143t + 3.57^2 = - 12.755 + 3.57^2

( t - 3.57)^2 = 0.000102

( t - 3.57 ) = +/-( 0.01 )

t = 3.57 + 0.01

t = 3.58 seconds

Ignore the negative one.

(C) the total time tAC needed for it to reach the ground at C from the instant it is released.

When the object is falling back from B, the initial velocity = 0. And the height h will be 60 + 62.5 = 122.5 ft

Using equation 2 of equations of motion again.

h = 1/2gt^2

122.5 = 1/2 × 9.8 × t^2

122.5 = 4.9t^2

t^2 = 122.5/4.9

t^2 = 25

t = 5

Total time = 5 + 3.58 = 8.58 seconds

3 0
3 years ago
What are the two main what are the two main concerns in the research of fluid power efficiency?
Galina-37 [17]

Answer:

The correct option is;

Materials and Components

Explanation:

The efficiency of fluid power is influenced by the components and the materials used to deliver the power of the fluid as such fluid power control are focused on

1) Advances in fluid power

2) Making use of the advantages

3) Making use of the other externally available technological advantages

4) Giving allowance for disadvantages

Areas of interest in advances in fluid power are;

a. Computer optimized flow

b. The use of new and improved materials/coatings

c. The use of components that save energy, such as intelligent supply pressure adapting systems

3 0
2 years ago
Read 2 more answers
1.8 A water flow of 4.5 slug/s at 60 F enters the condenser of steam turbine and leaves at 140 F. Determine the heat transfer ra
Ann [662]

Answer:

Hr=4.2*10^7\ btu/hr

Explanation:

From the question we are told that:

Water flow Rate R=4.5slug/s=144.78ib/sec

Initial Temperature T_1=60 \textdegree F

Final Temperature  T_2=140 \textdegree F

Let

Specific heat of water \gamma= 1

And

 \triangle T= 140-60

 \triangle T= 80\ Deg.F

Generally the equation for Heat transfer rate of water  H_r is mathematically given by

Heat transfer rate to water= mass flow rate* specific heat* change in temperature

 H_r=R* \gamma*\triangle T

 H_r=144.78*80*1

 H_r=11582.4\ btu/sec

Therefore

 H_r=11582.4\ btu/sec*3600

 Hr=4.2*10^7\  btu/hr

3 0
3 years ago
A large increase in elevation can cause a carbureted engine to run ________ if not properly adjusted for the altitude. a Rich b
mash [69]

Answer:

B - Poor

Explanation:

As you get higher up, There is less oxygen which causes the engine to create less power.

3 0
3 years ago
Meaning of <br> Evaporation
Sedaia [141]

Answer:

The process from a liquid to a vapor.

Explanation:

Water is evaporated by heating up and turning into a vapor.

8 0
3 years ago
Read 2 more answers
Other questions:
  • How does the modern Diesel engine achieve higher power output without the use of higher compression ratio?
    5·1 answer
  • 1. How many types of pumps are present?​
    14·1 answer
  • A ceramic material can be defined as an organic compound consisting of a metal or semimetal and one or more nonmetals: (a) true
    9·1 answer
  • A converging - diverging frictionless nozzle is used to accelerate an airstream emanating from a large chamber. The nozzle has a
    15·2 answers
  • 1. Given: R= 25 , E = 100 V<br> Solve for I
    5·1 answer
  • g Clay sized particles in a river are likely to be transported as _______________________, whereas gravel sized particles are li
    5·1 answer
  • Match the use of the magnetic field to its respective description.​
    6·1 answer
  • Disconnecting a circuit while in operation can create a voltage blank
    15·1 answer
  • Pls answer and I will give a like!
    8·1 answer
  • The air conditioner in a house or a car has a cooler that brings atmospheric air from 30C to 10C, with both states at 101KPa. If
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!