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 roller-coaster car is traveling at a speed of 23 m/s when it passes through point B. At that point, it enters a concave down c
ycow [4]

Answer:

See it in the pic

Explanation:

See it in the pic

8 0
3 years ago
how to calculate the torque when a force is applied on a cog? explain the step-by-step and provide an illustration/diagram. Can
yawa3891 [41]

Explanation:

Torque is the cross product of the radius vector and force vector:

τ = r × F

In other words, it is equal to the radius times the perpendicular component of the force.

τ = r · Ftangential

If we call θ the angle between the radius and the force, then:

τ = r · F sin θ

3 0
3 years ago
A food department is kept at -12 °C by a refrigerator in an environment at 30 °C. The total heat gain to the food department is
Nataly [62]

Answer: P = 0.416 kW

Explanation:

taken a step by step process to solving this problem.

we have that from the question;

the amount of heat rejected Qn = 4800 kJ/h

the cooling effect is Ql = 3300 kJ/h

Applying the first law of thermodynamics for this system gives us

Шnet = Qn -Ql

Шnet = 4800 - 3300 = 1500 kJ/h

Next we would calculate the coefficient of performance of the refrigerator;

COPr = Desired Effect / work output = Ql / Шnet  = 3300/1500 = 2.2

COPr = 2.2

The Power as required gives;

P = Qn - Ql  = 4800 - 3300 = 1500 kJ/h = 0.416

P = 0.416 kW

cheers i hope this helps!!!!1

5 0
3 years ago
The parts of a feature control frame are the tolerance value, the datum references, and the
Elan Coil [88]

Answer:

d

Explanation:

4 0
3 years ago
if you had 100 B size sheets and you cut them into A size sheets, how many sheets of A size paper would you have
castortr0y [4]

Answer:

200

Explanation:

A size sheets (also known as letter size) are 8.5 inches by 11 inches.

B size sheets (also known as ledger size) are 11 inches by 17 inches.

One B size sheet is twice as large as a A size sheet.  So if you have 100 B size sheets and cut each one in half, you'll get 200 A size sheets.

8 0
3 years ago
Other questions:
  • Students are expected to respond to one of the two questions described below. Students should provide examples to clarify their
    12·1 answer
  • Given the circuit at the right in which the following values are used: R1 = 20 kΩ, R2 = 12 kΩ, C = 10 µ F, and ε = 25 V. You clo
    11·1 answer
  • Argon is compressed in a polytropic process with n = 1.2 from 100 kPa and 30°C to 1200 kPa in a piston–cylinder device. Determin
    14·1 answer
  • SEICUL UC CULTELL allsvel.
    9·2 answers
  • This app, I'm done, bye... I can't, bye
    11·1 answer
  • FREEEEEE POOIIIINTS RIGHT HERE EVERYONE LEVEL UPPPP​
    13·2 answers
  • When does someone's work on the Internet become copyrighted?
    15·1 answer
  • A Styrofoam cup (k = 0.010 W/(m∙ o C)) has cross-sectional area (A) of 3.0 x 10 −2m 2 . The cup is 0.589 cm thick (L). The tempe
    12·1 answer
  • Estimate (a) the maximum, and (b) the minimum thermal conductivity values (in W/m-K) for a cermet that contains 76 vol% carbide
    9·1 answer
  • How many times greater is the value of the 2 of the 270413 than the valuce of the 2 in 419427?
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!