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
Consider a system with two tasks, Task1 and Task2. Task1 has a period of 200 ms, and Task2 has a period of 300 ms. All tasks ini
Murrr4er [49]

<u>Explanation:</u>

Task 1 time period = 200ms, Task 2 time period = 300ms

Task ticked = \frac{1000ms}{200ms}= 5  →  5 times

Task 2 ticked =\frac{1000ms}{300ms} = 3.33 → 3 times

At 600 ms → 200ms 200ms 200ms

                     300ms → \frac{30ms}{60ms}

Largest time period = H.C.M of (200ms, 300ms)

                                 = 600ms

4 0
2 years ago
R-744 refrigerant is bad why
mars1129 [50]

Answer:

Explanation:

R-744 is seen as the 'perfect' natural refrigerant as it is climate neutral and there is not a flammability or toxicity risk. It is rated as an A1 from ASHRAE. While it is non-toxic there is still risk if a leak occurs in an enclosed area as R-744 will displace the oxygen in the room and could cause asphyxiation

6 0
3 years ago
Calculate the molar heat capacity of a monatomic non-metallic solid at 500K which is characterized by an Einstein temperature of
aleksandr82 [10.1K]

Answer:

Explanation:

Given

Temperature of solid T=500\ K

Einstein Temperature T_E=300\ K

Heat Capacity in the Einstein model is given by

C_v=3R\left [ \frac{T_E}{T}\right ]^2\frac{e^{\frac{T_E}{T}}}{\left ( e^{\frac{T_E}{T}}-1\right )^2}

e^{\frac{3}{5}}=1.822

Substitute the values

C_v=3R\times (\frac{300}{500})^2\times (\frac{1.822}{(1.822-1)^2})

C_v=3R\times \frac{9}{25}\times \frac{1.822}{(0.822)^2}

C_v=0.97\times (3R)            

6 0
2 years ago
Establishes general guidelines concerning licensing and vehicle
gavmur [86]

Answer:

A. National Highway Safety Act

Explanation:

The National Highway Safety Act establishes general guidelines concerning licensing, vehicle registration and inspection, and traffic laws for state regulations. The act was made in 1966 to reduce the amount of death on the highway as a result of increase in deaths by 30% between 1960 and 1965

National Traffic and Motor Vehicle Safety Act regulates vehicle manufacturers  by ensuring national safety standards and issuance recalls for defective vehicles

Uniform Traffic Control Devices Act  defines shapes, colors and locations for road signs, traffic signals, and road markings

5 0
3 years ago
Read 2 more answers
What kind of energy transformation happens when a boy uses energy from a sandwich to run a race​
Semmy [17]
A boy eat a energy of a sandwich to run a race because when they eat a sandwich it helps them to help it mid workout and real nutritions of NYC and bring extra fuel and eating the right thing
I hope this help
4 0
3 years ago
Read 2 more answers
Other questions:
  • Please Help It's really Important
    12·1 answer
  • A banked highway is designed for traffic moving at v = 88 km/h. The radius of the curve r = 314 m. show answer No Attempt 50% Pa
    5·2 answers
  • A signalized intersection approach has three lanes with no exclusive left or right turning lanes. The approach has a 40-second g
    10·1 answer
  • The themes around which social sciences texts are organized boost understanding by
    11·1 answer
  • or a metal pipe used to pump tomato paste, the overall heat- transfer coefficient based on internal area is 2 W/(m2 K). The insi
    14·1 answer
  • What is an air mass?​
    5·2 answers
  • Draw the sequence of BSTs that results when you insert the keys E, A, S, Y, Q, U, E, S, T, I, O, N, in that order into an initia
    10·1 answer
  • A private plane pilot is what kind of individual transportation position? professional level mid-level entry-level EPA-certified
    9·1 answer
  • Fluid systems can distribute pressure unequally to all points in a system.<br><br> True<br> False
    15·1 answer
  • Porque el invento de la bombilla es importante?
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!