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
Assume (for simplicity in this exercise) that only one tuple fits in a block and memory holds at most three blocks. Show the run
den301095 [7]

Answer:

See explaination

Explanation:

Let's define tuple as an immutable list of Python objects which means it can not be changed in any way once it has been created.

Take a look at the attached file for a further detailed and step by step solution of the given problem.

6 0
3 years ago
In poor weather, you should _______ your following distance.
jasenka [17]

In poor weather, you should <u>double</u> your following distance.

6 0
3 years ago
The purpose of pasteurizing milk is to
katen-ka-za [31]

Answer:

i think it c

Explanation:

6 0
3 years ago
Read 2 more answers
Why does teachers grade things that are not due yet​
pav-90 [236]
I think because if you’ve already turned it in they might as well grade asap instead of waiting
4 0
3 years ago
Read 2 more answers
Radioactive wastes generating heat at a rate of 3 x 106 W/m3 are contained in a spherical shell of inner radius 0.25 m and outsi
MariettaO [177]

Answer:

Inner surface temperature= 783K.

Outer surface temperature= 873K

Explanation:

Parameters:

Heat,e= 3×10^6 W/m^3

Inner radius = 0.25 m

Outside radius= 0.30 m

Temperature at infinity, T(¶)= 10°c = 273. + 10 = 283K.

Convection coefficient,h = 500 W/m^2 . K

Temperature of the surface= T(s) = ?

Temperature of the inner= T(I) =?

STEP 1: Calculate for heat flux at the outer sphere.

q= r × e/3

This equation satisfy energy balance.

q= 1/3 ×3000000(W/m^3) × 0.30 m

= 3× 10^5 W/m^2.

STEP 2: calculus the temperature for the surface.

T(s) = T(¶) + q/h

T(s) = 283 + 300000( W/m^2)/500(W/m^2.K)

T(s) = 283+600

T(s)= 873K.

TEMPERATURE FOR THE OUTER SURFACE is 873 kelvin.

The same TWO STEPS are use for the calculation of inner temperature, T(I).

STEP 1: calculate for the heat flux.

q= r × e/3

q= 1/3 × 3000000(W/m^3) × 0.25 m

q= 250,000 W/m^2

STEP 2:

calculate the inner temperature

T(I) = T(¶) + q/h

T(I) = 283K + 250,000(W/m^2)/500(W/m^2)

T(I) = 283K + 500

T(I) = 783K

INNER TEMPERATURE IS 783 KELVIN

5 0
3 years ago
Other questions:
  • Select the level of education that is best demonstrated in each example.
    10·2 answers
  • The flowchart below shows the design steps required to build a working model.
    6·1 answer
  • Psychologist who uses behavioral approach to therapy would probably try which of the following
    13·2 answers
  • A flywheel performs each of these functions except: A. Contains a gear used for engine starting B. Smoothes engine operation C.
    11·1 answer
  • Create a Python program that will produce the following output:
    7·1 answer
  • A 35kg block of mass is subjected to forces F1=100N and F2=75N at agive angle thetha= 20° and 35° respectively.find the distance
    11·1 answer
  • The quantity of bricks required increases with the surface area of the wall, but the thickness of a masonry wall does not affect
    10·2 answers
  • What type of engineer works to create a practical and safe energy source?
    9·1 answer
  • How do you get your drivers lisnes when your 15
    8·1 answer
  • Tech B says that long-term fuel trims that are positive means that the PCM is leaning out the fuel mixture from the base pulse-w
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!