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]
2 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]2 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
A computer's hard disk drive holds 8 x 10^10 bytes of information. If Jill buys an extra memory stick that holds 5.1 X 10^8 byte
denis-greek [22]

Answer:

The computer will store 8.05 *10^10 bytes of information.

Explanation:

This is the same as saying that the computer will now have 80.51 Gigabytes ( 1gb = 1.000.000.000 bytes) of storage. In this case, the number is represented in its decimal form, and the previous one is displayed in Scientific Notation.

8 0
2 years ago
Cloud computing is often divided into three levels of services - infrastructure-as-a-service (IAAS), platform-as-a-service (PAAS
Alekssandra [29.7K]

Answer:

Infrastructure-as-a-Service

Explanation:

IaaS provides networking components such as backup, security, scaling, data partitioning and other vital computing resources needed. All these services are provided online using high-levels APIs (Application Programming Interface).

IaaS providers make resources available to customers from the equipment installed in data centers.

Therefore, the service that deals with networks, servers, and storage is Infrastructure-as-a-Service (IaaS

5 0
3 years ago
To set up scenarios, you need to first use ______ to set up a list, then ______ to set up the reference cell. Last you need to u
Sholpan [36]

To set up scenarios, you need to first use Goal seek to set up a list, then data table  to set up the reference cell. Last you need to use  VLOOKUP to set up the cells that display the output results from the scenario.

<h3>What is a Goal Seek in Excel?</h3>

Microsoft Excel is known to have a goal seeking tool that is said to be built-in and it is one that gives room for the user to know the desired input value for any kind of  formula if the output value is said to be already known.

Hence, To set up scenarios, you need to first use Goal seek to set up a list, then data table  to set up the reference cell. Last you need to use  VLOOKUP to set up the cells that display the output results from the scenario.

See full question below

To set up scenarios, you need to first use to set up a list, then to set up the reference cell. Last you need to use to set up the cells that display the output results from the scenario. CHOOSE; VLOOKUP; data table Goal seek; data table; VLOOKUP Data validation; VLOOKUP; CHOOSE Data table; VLOOKUP;

Learn more about  VLOOKUP from

brainly.com/question/14042837

#SPJ1

6 0
1 year ago
What is a data broker?
AleksAgata [21]

Answer:

The correct option is a.

A business that collects personal information about consumers and sells that information to other organizations.

Explanation:

Data brokers, also known as data suppliers, data fetchers, information brokers, or even data providers are businesses or companies (even individuals) that, on the most basic level, source and aggregate data and information (mostly information that are meant to be confidential or that are in the real sense difficult to get) and then resell them to third parties. These third parties could be other data brokers.  

They collect data and information from a wide range of resources and sources - offline and/or online e.g web access history, bank details, credit card information, official records (such as birth and marriage certificates, driver's licenses).  

Brokers can steal round about any information. Examples of information that brokers legally or illegally steal are full name, residential address, marital status, age, gender, national identification number, bank verification number. Brokers and hackers are siblings.

A couple types of data brokers are:

1. Those for fraud detection

2. Those for risk mitigation  

Hope this helps!

6 0
3 years ago
How might your use of computers and knowledge of technology systems affect your personal and professional success?
RUDIKE [14]
It can help you more be aware of whats going on and what you need to do.
8 0
2 years ago
Other questions:
  • The strFirstName and strLastName variables contain the strings "Jane" and "Jones," respectively. Which of the following statemen
    14·1 answer
  • Which of the following is NOT one of the most important elements when designing a website?
    8·2 answers
  • Jim is in the market for a car that will last for the next 10 years and has saved up some money for the purpose of a car. What’s
    6·1 answer
  • The speed of sound depends on the material the sound is passing through. Below is the approximate speed of sound (in feet per se
    9·1 answer
  • What is the name given to a collection of related fields such as ID number,name and address?
    12·1 answer
  • In order to install a device, the operating system needs the required __________ for that device.
    13·2 answers
  • Match the installation type to its description.
    9·1 answer
  • Since the rules cannot address all circumstances, the Code includes a conceptual framework approach for members to use to evalua
    8·1 answer
  • How can you remove background noise from a video?
    15·2 answers
  • Write l for law of enrtia,ll for law of Acceleration and lll for law of enteraction.
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!