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
MakcuM [25]
2 years ago
12

C++A palindrome is a string such as "madam", "radar", "Dad", and "I", that reads the same forwards and backwards. The empty stri

ng is regarded as a palindrome. Wrtie a recursive functionbool isPalindrome(string str, int lower, int upper)that returns true if and only if the part of the string str in positions lower through upper (inclusive at both ends) is a palindrome. Test your function by writting a main function that repeatedly asks the user to enter strings terminated by the ENTER key. These strings are then tested for palindromecity. The program termintaes when the user presses the Enter key without typing any haracters before it.
Engineering
1 answer:
jeka57 [31]2 years ago
5 0

Answer:

See explaination

Explanation:

#include <iostream>

#include<string.h>

using namespace std;

bool isPalindrome(string str, int lower, int upper){

if(str.length() == 0 || lower>=upper){

return true;

}

else{

if(str.at(lower) == str.at(upper)){

return isPalindrome(str,lower+1,upper-1);

}

else{

return false;

}

}

}

int main(){

string input;

cout<<"Enter string: ";

cin>>input;

if(isPalindrome(input,0,input.length()-1)){

cout<<input<<" is a palindrome"<<endl;

}

else{

cout<<input<<" is NOT a palindrome"<<endl;

}

return 0;

}

You might be interested in
In order to fill a tank of 1000 liter volume to a pressure of 10 atm at 298K, an 11.5Kg of the gas is required. How many moles o
lesya [120]

Answer:

The molecular weight will be "28.12 g/mol".

Explanation:

The given values are:

Pressure,

P = 10 atm

  = 10\times 101325 \ Pa

  = 1013250 \ Pa

Temperature,

T = 298 K

Mass,

m = 11.5 Kg

Volume,

V = 1000 r

   = 1 \ m^3

R = 8.3145 J/mol K

Now,

By using the ideal gas law, we get

⇒ PV=nRT

o,

⇒ n=\frac{PV}{RT}

By substituting the values, we get

       =\frac{1013250\times 1}{8.3145\times 298}

       =408.94 \ moles

As we know,

⇒ Moles(n)=\frac{Mass(m)}{Molecular \ weight(MW)}

or,

⇒        MW=\frac{m}{n}

                   =\frac{11.5}{408.94}

                   =0.02812 \ Kg/mol

                   =28.12 \ g/mol

3 0
3 years ago
DRIVERS ED
forsale [732]

Answer:

b

Explanation:

only if there signal is turned on

8 0
3 years ago
Read 2 more answers
The principal value of a Pareto diagram is as a
vlada-n [284]

The Pareto principle is that most things in our life are not commonly distributed.

<u>Explanation:</u>

Pareto chart shows that most of the things which we have in our life and the resources in our life are not equally distributed. The ratio is not always 50:50 according to this principle.

The most important use of a Pareto diagram is to show the most important factor among the set of factors that have been shown. Along with that it also shows the sources which lead to the common defects in the system and tries to solve those defects which occur most often.

4 0
3 years ago
A gearbox is needed to provide an exact 30:1 increase in speed, while minimizing the
alekssr [168]

Answer:

answer

Explanation:

4 0
2 years ago
The following program includes fictional sets of the top 10 male and female baby names for the current year. Write a program tha
otez555 [7]

Answer:

Define Variables and Use List methods to do the following

Explanation:

#<em>Conjoins two lists together</em>

all_names = male_names.union(female_names)

#<em>Finds the names that appear in both lists, just returns those</em>

neutral_names = male_names.intersection(female_names)

#<em>Returns names that are NOT in both lists</em>

specific_names = male_names.symmetric_difference(female_names)

3 0
2 years ago
Read 2 more answers
Other questions:
  • The elevation of the end of the steel beam supported by a concrete floor is adjusted by means of the steel wedges E and F. The b
    12·2 answers
  • a. Determine R for a series RC high-pass filter with a cutoff frequency (fc) of 8 kHz. Use a 100 nF capacitor. b. Draw the schem
    7·1 answer
  • Select the right answer<br>​
    8·1 answer
  • Two Technicians are discussing shock absorbers. Technician A says most shock absorbers help support vehicle weight. Technician B
    5·1 answer
  • Exercise 5.46 computes the standard deviation of numbers. This exercise uses a different but equivalent formula to compute the s
    12·1 answer
  • A piston–cylinder device contains 0.78 kg of nitrogen gas at 140 kPa and 37°C. The gas is now compressed slowly in a polytropic
    11·1 answer
  • A power plant burns natural gas to supply heat to a heat engine which rejects heat to the adjacent river. The power plant produc
    11·1 answer
  • A beam has been fixed to the floor by the pin at B and the roller at A as shown in figure 1 below.​
    7·1 answer
  • What are some sources of resistance? (Check all
    5·1 answer
  • Develop a simple Business plan as an entrepreneur​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!