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
ANSWER QUICK<br>Why did Winston Churchill take over for Neville Chamberlain shortly after ww2? ​
kenny6666 [7]

Answer:neville chamberlain died

Explanation:

4 0
3 years ago
What's the highest grade level that brainly accomodates
taurus [48]

Answer:

The highest grade level is college.

3 0
2 years ago
Select four examples of fluid or pneumatic power systems.
Dennis_Churaev [7]

Answer:

Students learn about the fundamental concepts important to fluid power, which includes both pneumatic (gas) and hydraulic (liquid) systems. Both systems contain four basic components: reservoir/receiver, pump/compressor, valve, cylinder.

Explanation:

8 0
3 years ago
Read 2 more answers
Need help solving math problem using integration
notka56 [123]
Ummm did you try to add or subtract and multiply or divide that can get your answer
8 0
2 years ago
What is the best engineering job to do? Why?
allochka39001 [22]

Answer:

Any engineering job would be good YOU should be the one choosing which job.

Explanation:

Engineering is a great outlet for the imagination, and the perfect field for independent thinkers.

7 0
2 years ago
Read 2 more answers
Other questions:
  • Five bolts are used in the connection between the axial member and the support. The ultimate shear strength of the bolts is 320
    5·1 answer
  • A four-cylinder, four-stroke internal combustion engine has a bore of 3.7 in. and a stroke of 3.4 in. The clearance volume is 16
    14·1 answer
  • An air-standard cycle with constant specific heats at room temperature is executed in a closed system with 0.003 kg of air and c
    15·1 answer
  • Megan is an architect who is creating a building design. Which is a prominent technical aspect that she needs to keep in mind wh
    12·1 answer
  • An R-134a refrigeration system is operating with an evaporator pressure of 200 kPa. The refrigerant is 10% in vapor phase at the
    15·1 answer
  • Which are the most common location for a collision between a bike and a car?
    8·1 answer
  • Always refill your gas tank well before
    6·1 answer
  • Air at atmospheric pressure and at 300K flows with a velocity of 1.5m/s over a flat plate. The transition from laminar to turbul
    13·1 answer
  • A 250 kilo ohms and a 750 kilo ohms resistor are connected in series across a 75-volt source. Determine the error in measuring t
    10·1 answer
  • A furnace uses preheated air to improve its fuel efficiency. Determine the adiabatic flame temperature when the furnance is oper
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!