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
brilliants [131]
2 years ago
7

Write a program that uses the function isPalindrome given in Example 6-6 (Palindrome). Test your program on the following string

s: madam, abba, 22, 67876, 444244, trymeuemyrt Modify the function isPalindrome of Example 6-6 so that when determining whether a string is a palindrome, cases are ignored, that is, uppercase and lowercase letters are considered the same. The isPalindrome function from Example 6-6 has been included below for your convenience.bool isPalindrome(string str){int length = str.length();for (int i = 0; i < length / 2; i++){if (str[i] != str[length - 1 - i] )return false;}return true;}
Computers and Technology
1 answer:
Artist 52 [7]2 years ago
6 0

Answer:

#include <bits/stdc++.h>

using namespace std;

bool isPalindrome(string str)

{

   char a,b;

int length = str.length();

for (int i = 0; i < length / 2; i++)

{

   a=tolower(str[i]);//Converting both first characters to lowercase..

   b=tolower(str[length-1-i]);

   if (b != a )

return false;

}

return true;

   

}

int main() {

   string t1;

   cin>>t1;

   if(isPalindrome(t1))

   cout<<"The string is Palindrome"<<endl;

   else

   cout<<"The string is not Palindrome"<<endl;

return 0;

}

Output:-

Enter the string

madam

The string is Palindrome

Enter the string

abba

The string is Palindrome

Enter the string

22

The string is Palindrome

Enter the string

67876

The string is Palindrome

Enter the string

444244

The string is not Palindrome

Explanation:

To ignore the cases of uppercase and lower case i have converted every character to lowercase then checking each character.You can convert to uppercase also that will also work.

You might be interested in
Select the true statement from the choices below. Group of answer choices Invalid code may cause browsers to render the pages sl
IrinaK [193]

Answer:

(A) A web page will not display in a browser unless it passes syntax validation testing.

(C)A web page must pass syntax validation testing before it is used.

Explanation:

A website is a collection of related web pages. A web page is an electronically arranged content page, designed and developed using web development application and language tool and hosted on a web server.

Web page or application development follows a series of well defined stages called software development life cycle (SDLC). The web application must go through these processes from birth to the end-of-life of the application.

The validation testing in SDLC, consisting of unit, acceptance and loading testing, which checks for syntax error or bugs on the written codes, because bugs could slow the loading of the page or even the display and browser compatibility of elements in the code.

5 0
3 years ago
Which troubleshooting tool enables you to connect to a user's remote computer, view and interact with the user's screen, and cha
DaniilM [7]
That would be Remote assistance.
6 0
3 years ago
When preparing the heading for an MLA Format Academic Report, which of the following shows the proper order of the for lines of
Sloan [31]

Answer:

A. Student Name, Instructor, Course, Date

Explanation:

Begin one inch from the top of the first page and flush with the left margin. Type your name, your instructor's name, the course number, and the date on separate lines, using double spaces between each. Double space once more and center the title

3 0
3 years ago
Whats included in ms office 2013 professional?
MrMuchimi
Powerpoint, word document, and excel
3 0
3 years ago
Please Help ASAP!!
Maurinko [17]

Answer:

in the page layout view

Explanation:

7 0
3 years ago
Read 2 more answers
Other questions:
  • Which type of network cover a large geographical area and usually consists of several smaller networks, which might use differen
    5·1 answer
  • Complete function PrintPopcornTime(), with int parameter bagOunces, and void return type. If bagOunces is less than 3, print "To
    9·1 answer
  • According to the "multiple-selves" theory, of an online DVD rental service could offer same-day deliveries, so that people who o
    9·1 answer
  • Kim would like to have a simple method for entering data into a database. She should create a _____.
    14·2 answers
  • What are the three control statements in Qbasic?​
    10·1 answer
  • Please Help! <br> I need good Anime to watch!
    7·1 answer
  • What is operating system​
    10·2 answers
  • Can someone help me with python
    10·1 answer
  • Multiple Choice
    9·1 answer
  • Another name of computer program is
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!