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
evablogger [386]
3 years ago
11

A palindrome is any word, phrase, or sentence that reads the same forward and backward. Here are some well-known palindromes: Ab

le was I, ere I saw Elba A man, a plan, a canal, Panama Desserts, I stressed Kayak Write a bool function that uses recursion to determine if a string argument is a palindrome. The function should return true if the argument reads the same forward and backward. Demonstrate the function in a program.
Computers and Technology
1 answer:
Pavlova-9 [17]3 years ago
5 0

Answer:

Following are the program in the C++ Programming Language.

//header file

#include <iostream>

//header file for string

#include <string>

#include<cstring>

//using namespace

using namespace std;

//define Function to checks the string is passed is a Palindrome or not

bool is_Palin(string strng, int start_Position, int end_Position)

{

//set the if Conditional statement

if(start_Position >= end_Position)

{

return true;

}

//Check if the character is not the alphabet

if(!isalpha(strng[start_Position]))

{

//Update the starting position  

start_Position += 1;

//call Recursive function

return is_Palin(strng, start_Position++, end_Position);

}

//Check if the character is not the alphabet

if(!isalpha(strng[end_Position]))

{

//Update the end position

end_Position -= 1;

//call Recursive function

return is_Palin(strng, start_Position, end_Position--);

}

//Check if the characters are same or not same

if(tolower(strng[start_Position]) != tolower(strng[end_Position]))

{

return false;

}

//Update the positions

start_Position = start_Position + 1;

end_Position = end_Position - 1;

//call Recursive function

return is_Palin(strng, start_Position, end_Position);

}

//define Main function

int main()

{

string strng;

//get string from the user

cout << "\n\n Enter a string: ";

getline(cin, strng);

//Check for the palindrome

if(is_Palin(strng, 0, strlen(strng.c_str())-1))

{

 //then print message

cout << "\n Is a Palindrome!!!! \n";

}

//otherwise

else

{

//then print message

cout << "\n Is not a Palindrome!!!! \n";

}

return 0;

}

<u>Output:</u>

Enter a string:  Able was I, ere I saw Elba

Is a Palindrome!!!!

Explanation:

Here, we define a boolean data type function "is_Palin" to check the string which passed through is palindrome or not and pass and pass two integer type arguments for starting position and ending position and pass one string data type argument to pass string, inside the function.

  • Set the if conditional statement to check the condition if the start_position of the string is greater than end _position of the string then return true.
  • Set the if conditional statement to check the condition the start_position of the staring is alphabet then, update the start_position and call the recursion function.
  • Again set the if conditional statement to check the condition the end_position of the staring is alphabet then, update the end_position and call the recursion function.
  • Set the if conditional statement to check the condition if the start_position of the string is not equal to the end _position of the string then, return false.
  • Then, update the start_position and end _position of the string increment by 1 then, call the recursive function and then, close the function.

Finally, we define the main function and pass string through calling and passing and argument list in its parameter.  

You might be interested in
Someone help meeeeeeeee plz.......................
xenn [34]

Answer:

B-2

      C-3

1/9

Explanation:

3 0
3 years ago
Read 2 more answers
Why is internet download speed slower on a computer vs phone
oee [108]

Answer:

The difference in tech.

Explanation:

The biggest gap here is the computer's ability to be hardwired (ethernet). It is almost always faster.

3 0
2 years ago
The benefits associated with software reuse are lower cost, better quality,
Sholpan [36]

Answer:

Software reuse is the technique through which updating the software system through the already defined components or assets of the software.This helps in increasing the productivity ,cost decrement , quality improvement etc.

But in actual case, the software reuse still persist high cost due to modification of inflexible designing of software .It also costs more than expected for the maintenance and training of software.

The security of the software is always at risk because of the usual and advanced hacking and attacking by the hackers even when the protect of software is high.Thus, these statements verify that the benefits of cost and security of software is not actually realized.

6 0
3 years ago
Can you think of a situation that might create a problem for a website’s security? What could a back-end developer do to prevent
Yuki888 [10]

A situation that might create a problem for a website’s security is known o be  as a result of Outside people having access to a companies website and documents and also hackers hacking into a company database.

Others are;

  • Lack of authentication in company security.
  • Access control-linked misconfigurations.
  • A Software misconfigurations.

<h3>What could a back-end developer do to prevent this situation from occurring?</h3>
  • Always Encrypt sensitive data:
  • Do not use weak encryption algorithm.

The back end in cyber security is know to be a sort of a kind of a repository of all that entails your web presence and also that of your mobile apps and it is one that makes it to run smoothly.

Hence, A situation that might create a problem for a website’s security is known o be  as a result of Outside people having access to a companies website and documents and also hackers hacking into a company database.

Learn more about website’s security from

brainly.com/question/10450768

#SPJ1

4 0
2 years ago
In Microsoft word you can access the blank command from the mini toolbar
Softa [21]
Your answer would be:
<span>
In Microsoft Word you can access the </span><span>insert citation command from the mini toolbar.</span>
3 0
4 years ago
Other questions:
  • Which of the following attacks is MOST likely the cause when a user attempts to go to a website and notices the URL has changed?
    10·1 answer
  • What feature did the 32X add to the Sega Genesis?
    13·1 answer
  • To resize an embedded chart, ____. select one:
    5·1 answer
  • An email address is made up of all of the following parts except
    13·2 answers
  • ] why was drone-defense equipment deployed at airports in the United Kingdom?
    13·1 answer
  • As you explore career options why is it important to take personal inventory is and assessments
    13·2 answers
  • The term____relates to all things that we see.
    13·1 answer
  • Assume you need to test a function named max. The function max receives two int arguments and returns the larger. Write the defi
    6·1 answer
  • How do you answer someone's question when they have asked?
    5·2 answers
  • Which validation method would you use for first name on a data form
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!