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
The Hamming encoder/decoder in the lecture detected and corrected one error bit. By adding a thirteen bit which is the exclusive
krek1111 [17]

Cos of error of special characters

The solution has been attached to the portal

7 0
3 years ago
In some states, repair shops can accept used oil from do-it-yourselfers or ____________.
MrMuchimi

Answer:

C. Homeowners

Explanation:

I just took my automotive pollution prevention certification and passed by answering homeowners for this question.

7 0
3 years ago
1. Select the punch that is used to make a mark in metal
s344n2d4d5 [400]

Answer:

pin punch

Explanation:

  1. <em><u>Pin</u></em><em><u> </u></em><em><u>Punch</u></em><em><u> </u></em>
  2. <em><u> </u></em><em><u>pin</u></em><em><u> </u></em><em><u>punch</u></em>
8 0
3 years ago
Concerned with the number of maintenance visits the rocket can undergo before being out of service, you have been informed that
Ainat [17]

Answer:

(a) Mn = M₁ + (n-1) (M₂ -M₁) = 1 + (n- 1) 1 = n (b) n > 10 (exceed 10) or n =11 (c) n >50 or n= 51

After making a journey of 51 times, the rocket will be discarded

Explanation:

Solution

(a) Let Mn denotes the number of  maintenance visits after the nth journey

Then M₁ = 1 , M₂ = 1 +M₁ = 2, M₃ = 1 +M₂ = 3

We therefore, notice that M follows an arithmetic sequence

So,

Mn = M₁ + (n-1) (M₂ -M₁)

= 1 + (n- 1) 1 = n

or Mn =n

(b)  For what value of n we will get  fro Mn > 10

Thus,

n > 10 (exceed 10) or n =11

(c)Similarly of Mn is greater than 50 or Mn>50, the rocket will not be used or reused

So,

n >50 or n= 51

After making a journey of 51 times, the rocket will be discarded

7 0
4 years ago
If you are rejected for a promotion, you should ask for feedback so you can ________.
irina [24]
C because it’s professional
8 0
3 years ago
Other questions:
  • What is the rms current flowing through a light bulb that uses an average power of 60.0 60.0 W when it is plugged into a wall re
    12·1 answer
  • Calibrations on a recent version of an operating system showed that on the client side, there is a delay of at least 0.5 ms for
    13·1 answer
  • There are 10 vehicles in a queue when an attendant opens a toll booth. Vehicles arrive at the booth at a rate of 4 per minute. T
    6·1 answer
  • A closed, 5-m-tall tank is filled with water to a depth of 4 m. The top portion of the tank is filled with air which, as indicat
    13·1 answer
  • Emergency plans are being formulated so that rapid action can be taken in the event of an equipment failure. It is predicted tha
    12·2 answers
  • A cubic transmission casing whose side length is 25cm receives an input from the engine at a rate of 350 hp. If the vehicle's ve
    5·1 answer
  • Question # 3
    13·1 answer
  • Hey, Whos sooo bored right now? Also who is going to get a pet soon? I find the perfect pet for you for free!
    14·1 answer
  • In the engineering design process, what do engineers do immediately before
    7·1 answer
  • What are the three primary factors on which encryption is based?.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!