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]
3 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]3 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
What is the difference between filler and electrode in Welding? Can a filler be an electrode? Can an electrode be a filler? Why?
Vlada [557]

Explanation:

<u>Filler:</u>

  Filler is the material rod is used when we are joining two material by using welding process.If thickness of work piece is more so it will become compulsory to provide some filler material for making the welding join to withstand high stresses.

<u>Electrode:</u>

  Electrode is the element which is used to complete the electric circuit in welding .Some time electrode is connected with positive terminal and some time with negative terminal ,it depends on the requirement of welding process.In Tungsten inert gas welding electrode is connected negative terminal but on the other hand Metal inert gas welding electrode is connected with positive terminal.Electrode can be consumable non-consumable depends on the condition.

Yes electrode can be work as filler material ,in Metal inert gas welding wire is used as electrode as well as filler material.In Metal inert gas welding consumable electrode is used on the other hand Tungsten inert gas welding non-consumable electrode is used.In Tungsten inert gas welding if thickness of work pieces is less than 5 mm then no need to used any filler material but if thickness is more than 5 mm then we have to use filler material.

8 0
3 years ago
What is a motor cycle motor made out of
Natali5045456 [20]

Explanation:

a motorcycle Motor is made out of iron

4 0
3 years ago
Read 2 more answers
Technologies that allow for instant worldwide communication include
hram777 [196]

Answer:

mobile phones and internet access

Explanation:

I got it right on my quiz

7 0
3 years ago
Read 2 more answers
A circular specimen of MgO is loaded in three-point bending. Calculate the minimum possible radius of the specimen without fract
Hitman42 [59]

Answer:

radius = 9.1 × 10^{-3} m

Explanation:

given data

applied load = 5560 N

flexural strength = 105 MPa

separation between the support =  45 mm

solution

we apply here minimum radius formula that is

radius = \sqrt[3]{\frac{FL}{\sigma \pi}}      .................1

here F is applied load and  is length

put here value and we get

radius =  \sqrt[3]{\frac{5560\times 45\times 10^{-3}}{105 \times 10^6 \pi}}  

solve it we get

radius = 9.1 × 10^{-3} m

8 0
3 years ago
Led test lights are used to test circuits that include controllers and computers. True or false
Marianna [84]

Answer:

True

Explanation:

An LED test light is a piece of electronic test equipment used to determine the presence of electricity in a piece of equipment under test, making this statement true.

3 0
2 years ago
Other questions:
  • In this milestone we will create a Course class to represent a course and display its information on the screen. We will create
    9·1 answer
  • Refers to the capability to keep moving forward on a specified grade.
    5·1 answer
  • Time complexity of merge sort
    15·1 answer
  • Block A has a weight of 8 lb. and block B has a weight of 6 lb. They rest on a surface for which the coefficient of kinetic fric
    8·1 answer
  • Fix the code so the program will run correctly for MAXCHEESE values of 0 to 20 (inclusive). Note that the value of MAXCHEESE is
    8·1 answer
  • Water enters an ice machine at 55°F and leaves as ice at 25°F. If the COP of the ice machine is 2.45 during this operation, dete
    7·1 answer
  • name the process by which mild steel can be converted into high carbon steel and explain it briefly ?​
    12·1 answer
  • Explain with examples:<br> What are the reasons of a successful and unsuccessful software project?
    8·1 answer
  • When framing a building, a simple way to estimate the total amount of wall studs needed is to allow
    7·1 answer
  • The most important reason to wear your seat belt is to protect you from:
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!