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
Driving Distraction Brainstorming Session
Leto [7]

texting, phone calls, putting on makeup, brushing hair, movies playing in car, loud music, children, and that's pretty much all I could think of

please give <u>BRAINLIEST ANSWER └[T‸T]┘</u>

5 0
3 years ago
A small pad subjected to a shearing force is deformed at the top of the pad 0.08 in. The height of the pad is 1.38 in. What is t
Aleksandr-060686 [28]

Answer:

The shear strain is 0.05797 rad.

Explanation:

Shear strain is the ratio of change in dimension along the shearing load direction to the height of the plate under application of shear load. Width of the plate remains same. Length of the plate slides under shear load.

Step1

Given:

Height of the pad is 1.38 in.

Deformation at the top of the pad is 0.08 in.

Calculation:

Step2

Shear strain is calculated as follows:

tan\phi=\frac{\bigtriangleup l}{h}

tan\phi=\frac{0.08}{1.38}

tan\phi= 0.05797

For small angle of \phi, tan\phi can take as\phi.

\phi = 0.05797 rad.

Thus, the shear strain is 0.05797 rad.

7 0
3 years ago
When your fixing a car, what is the first thing you want to do?
Shtirlitz [24]

Answer:

Changing oil.

Explanation:

You need to regularly check and change your car’s oil to ensure smooth running of the vehicle and to prolong the lifespan of its engine.

6 0
3 years ago
Refrigerant 134a enters the evaporator of a refrigeration system operating at steady state at -16oC and a quality of 20% at a ve
Dmitry [639]

Answer:

mass flow rate = 0.0534 kg/sec

velocity at exit = 29.34 m/sec

Explanation:

From the information given:

Inlet:

Temperature T_1 = -16^0\ C

Quality x_1 = 0.2

Outlet:

Temperature T_2 = -16^0 C

Quality  x_2 = 1

The following data were obtained at saturation properties of R134a at the temperature of -16° C

v_f= 0.7428 \times 10^{-3} \ m^3/kg \\ \\  v_g = 0.1247 \ m^3 /kg

v_1 = v_f + x_1 ( vg - ( v_f)) \\ \\ v_1 = 0.7428 \times 10^{-3} + 0.2 (0.1247 -(0.7428 \times 10^{-3})) \\ \\  v_1 = 0.0255 \ m^3/kg \\ \\ \\  v_2 = v_g = 0.1247 \ m^3/kg

m = \rho_1A_1v_1 = \rho_2A_2v_2 \\ \\  m = \dfrac{1}{0.0255} \times \dfrac{\pi}{4}\times (1.7 \times 10^{-2})^2\times 6  \\ \\ \mathbf{m = 0.0534 \ kg/sec}

\rho_1A_1v_1 = \rho_2A_2v_2 \\ \\ A_1 =A_2  \\ \\  \rho_1v_1 = \rho_2v_2   \\ \\ \implies \dfrac{1}{0.0255} \times6 = \dfrac{1}{0.1247}\times (v_2)\\ \\ \\\mathbf{\\ v_2 = 29.34 \ m/sec}

3 0
3 years ago
How does manufacturing affect the economy and society?
ratelena [41]

Explanation:

Because manufacturing has so many substantial links with so many other sectors throughout the economy, its output stimulates more economic activity across society than any other sector. That's a major reason manufacturers play such a critical role in growth.

6 0
3 years ago
Read 2 more answers
Other questions:
  • A controller on an electronic arcade game consists of a variable resistor connected across the plates of a 0.227 μF capacitor. T
    6·1 answer
  • Why must air tanks be drained​
    15·1 answer
  • If you are convicted of D.U.I. a second time in five years, your license may be revoked for up to __________ year/s.
    10·1 answer
  • Can someone help plz?!?
    5·2 answers
  • Which of the following is a direct result of technological improvements in the music industry?
    9·2 answers
  • In a wire, when elongation is 4 cm energy stored is E. if it is stretched by 4 cm, then what amount of elastic potential energy
    15·2 answers
  • Technician A says that the distributor cap provides a connection point between the rotor and each individual cylinder plug wire.
    10·1 answer
  • How would you design a wheelchair for wheelchair-using basketball players? Would you make it more or less massive?
    11·1 answer
  • A single-phase load is located 2800 ft from its source. The load draws a current of 86 A and operates on 480 V. The maximum volt
    10·1 answer
  • How might a field like philosophy of history help scientists​
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!