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
Select three types of engineering that involve work in inaccessible environments.
Pavel [41]

Answer:

Chemical Engineer,Geological Engineer,Aerospace Engineer

Explanation:

8 0
3 years ago
Read 2 more answers
The purpose of pasteurizing milk is to
katen-ka-za [31]

Answer:

i think it c

Explanation:

6 0
3 years ago
Read 2 more answers
Design a plan for ""your yard"" (no matter where you live) that will capture and utilize rainwater. You can prepare the plan in
Jlenok [28]

Answer:

Explanation:

<u><em>General Considerations</em></u>

The design of the yard will affect the natural surface and subsurface drainage pattern of a watershed or individual hillslope. Yard drainage design has as its basic objective the reduction or elimination of energy generated by flowing water. The destructive power of flowing water increases exponentially as its velocity increases. Therefore, water must not be allowed to develop sufficient volume or velocity so as to cause excessive wear along ditches, below culverts, or along exposed running surfaces, cuts, or fills.

A yard drainage system must satisfy two main criteria if it is to be effective throughout its design life:

1. It must allow for a minimum of disturbance of the natural drainage pattern.  

2.It must drain surface and subsurface water away from the roadway and dissipate it in a way that prevents excessive collection of water in unstable areas and subsequent downstream erosion

The diagram below ilustrate diffrent sturcture of yard to be consider before planing to utiliza rainwater

4 0
3 years ago
Almost all collisions are due to driver error
blondinia [14]

Answer:

Where's the questaion?

4 0
2 years ago
Water at 200C flows through a pipe of 10 mm diameter pipe at 1 m/s. Is the flow Turbulent ? a. Yes b. No
Degger [83]

Answer:

Yes, the flow is turbulent.

Explanation:

Reynolds number gives the nature of flow. If he Reynolds number is less than 2000 then the flow is laminar else turbulent.

Given:

Diameter of pipe is 10mm.

Velocity of the pipe is 1m/s.

Temperature of water is 200°C.

The kinematic viscosity at temperature 200°C is 1.557\times10^{-7}m2/s.

Calculation:

Step1

Expression for Reynolds number is given as follows:

Re=\frac{vd}{\nu}

Here, v is velocity, \nu is kinematic viscosity, d is diameter and Re is Reynolds number.

Substitute the values in the above equation as follows:

Re=\frac{vd}{\nu}

Re=\frac{1\times(10mm)(\frac{1m}{1000mm})}{1.557\times10^{-7}}

Re=64226.07579

Thus, the Reynolds number is 64226.07579. This is greater than 2000.

Hence, the given flow is turbulent flow.

5 0
3 years ago
Other questions:
  • Where Does a Solar Engineer Work? <br> (2 sentences or more please)
    14·2 answers
  • What is the maximum thermal efficiency possible for a power cycle operating between 600P'c and 110°C? a). 47% b). 56% c). 63% d)
    15·1 answer
  • Select all that apply.
    13·1 answer
  • 2. A fluid at 14.7 psi (lb-f per square inch) with kinematic viscosity (????????) 1.8 x10-4 ft2/sec and density(????????) 0.076
    11·1 answer
  • Which option supports the following scenario?
    14·1 answer
  • In this assignment, you will demonstrate your ability to write simple shell scripts. This is a cumulative assignment that will c
    8·1 answer
  • How to Cancel prescription
    12·1 answer
  • Quản trị học là gì ? ý nghĩa của quản trị học với thực tế xã hội
    10·1 answer
  • Explain the use of a vacuum gauge.
    15·1 answer
  • Incremental software development could be very effectively used for customers who do not have a clear idea about the systems nee
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!