Maurice Tutor

(5)

$15/per page/Negotiable

About Maurice Tutor

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Algebra,Applied Sciences See all
Algebra,Applied Sciences,Biology,Calculus,Chemistry,Economics,English,Essay writing,Geography,Geology,Health & Medical,Physics,Science Hide all
Teaching Since: May 2017
Last Sign in: 398 Weeks Ago, 3 Days Ago
Questions Answered: 66690
Tutorials Posted: 66688

Education

  • MCS,PHD
    Argosy University/ Phoniex University/
    Nov-2005 - Oct-2011

Experience

  • Professor
    Phoniex University
    Oct-2001 - Nov-2016

Category > Computer Science Posted 28 Aug 2017 My Price 9.00

Implement a recursive function

Implement a recursive function called palindrome(s), where s is a given string.A palindrome is a word or phrase that is spelled the same both forward and backward. For example, A????1levelA????1 is a palindrome.The palindrome( ) function is a predicate function that returns either true (1) or false (0), depending on whether or not a given word is a palindrome. The implementation for this function can be directly translated into C/C++from the following mathematical definition

Hint: (1) In mathematics |s |is read A????1the order of sA????1, which means the number of items in s. Since s is a string this translates to the number of characters in s. In C++ this can betranslated into code as s.length( ). (2) The substr( ) function is a built-in method used to return a sub string of a given string You can call this function on s as you did with the length( ) function. For example: s.substr ( ), but pass in the appropriate parameters.

Output: The output for program once the function is implemented is as follows:

deified=1

hannah=1

stacks=0

list=0

civic=1

kayak=1

tree=0

graph=0

Press any key to continue.

/**

* palindrome.cpp - This program implements a recursive predicate function

*      called isPalindrome();

*

* TODO: Include your name and course number here.

*/

#include

#include

#include

#include

using namespace std;

bool isPalindrome(string s);

int main(int argc, char **argv)

{

   cout << "deified=" << isPalindrome("deified") << endl;

   cout << "hannah=" << isPalindrome("hannah") << endl;

   cout << "stacks=" << isPalindrome("stacks") << endl;

   cout << "list=" << isPalindrome("list") << endl;

   cout << "civic=" << isPalindrome("civic") << endl;

   cout << "kayak=" << isPalindrome("kayak") << endl;

   cout << "tree=" << isPalindrome("tree") << endl;

   cout << "graph=" << isPalindrome("graph") << endl;

   cout << endl << "Press any key to continue." << endl;

   getchar();

   return 0;

}

bool isPalindrome(string s)

{

// TODO: Based on the mathematical definition in the

// handout, implement the details of the recursive

// isPalindrome function.

   

    return false;

}

Answers

(5)
Status NEW Posted 28 Aug 2017 01:08 PM My Price 9.00

Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll

Not Rated(0)