modifying the code c 1

Get perfect grades by consistently using our affordable writing services. Place your order and get a quality paper today. Take advantage of our current 20% discount by using the coupon code GET20

Order a Similar Paper Order a Different Paper

I just want to modify this code in a simple way so it does not look very different that how it is now.

#include <iostream>

#include <string>

bool sentencePalindrome(char *str);

#define MAX_SIZE 100

using namespace std;

int main()


char *c = new char[MAX_SIZE];

cout << “Enter a string: “;

cin.getline(c, MAX_SIZE);

cout << c << endl;

if (sentencePalindrome(c)) {

cout << “The entered string is palindrome” << endl;


else {

cout << “The entered string is not palindrome” << endl;


return 0;


bool sentencePalindrome(char *str)


int l = 0, h = strlen(str);

// converting the characters to lower case

for (int i = 0; i < h; i++)

*(str + i) = tolower(str[i]);

// compare the character

while (l <= h) {

if (!(*(str + l) >= ‘a’ && *(str + l) <= ‘z’))


else if (!(*(str + h) >= ‘a’ && *(str + h) <= ‘z’))


else if (*(str + l) == *(str + h))

l++, h–;


return false;


// Returns true if sentence is palindrome

return true;


Have your paper completed by a writing expert today and enjoy posting excellent grades. Place your order in a very easy process. It will take you less than 5 minutes. Click one of the buttons below.

Order a Similar Paper Order a Different Paper