modifying the code c 1
NursesHomeworkHelp.com prides itself on its team of specialized writers who possess comprehensive knowledge and experience in the field of nursing. These writers are selected through a rigorous vetting process, ensuring that they have the necessary qualifications and expertise in nursing. By engaging writers who understand the intricacies of the nursing profession, NursesHomeworkHelp ensures that students receive accurate and well-researched content that aligns with the unique requirements of the nursing discipline. This specialization sets NursesHomeworkHelp apart as a trusted source of academic support for nursing students.
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’))
l++;
else if (!(*(str + h) >= ‘a’ && *(str + h) <= ‘z’))
h–;
else if (*(str + l) == *(str + h))
l++, h–;
else
return false;
}
// Returns true if sentence is palindrome
return true;
}
NursesHomeworkHelp.com places a strong emphasis on delivering high-quality work that meets and exceeds academic standards. The company is committed to upholding excellence in every aspect of their service. The writers at NursesHomeworkHelp conduct thorough research, ensuring that assignments are well-informed and grounded in evidence-based practice. Moreover, they adhere to academic conventions, including proper referencing and citation, to ensure the integrity and credibility of the work. By consistently maintaining high-quality standards, NursesHomeworkHelp enables nursing students to excel academically and develop the necessary skills for their future careers.