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]
3 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]3 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
William has created a page view style sheet and saved it in a file named esd.css. What tags should William add to the document h
EleoNora [17]

Answer:

The answer is "<link href="esd.css" rel="stylesheet" />".

Explanation:

William will use the <link> tag because this tag is used to describe a connection between an external resource and an HTML file. In the <link> tag we use the href and rel attribute that is used to specify an anchor element target or destination and to define the current-linked file associate with.

  • This tag is an empty element, it contains only attributes.
  • The < link > tag is used to add existing style sheets.
  • The <link> tag also known as Singular Tag.
8 0
3 years ago
. Which of the following is NOT an option for increasinghard drive storage space?
Andrew [12]

Answer: B) Install an addition memory card to the current drive

Explanation: Drive  storage space is space that has particular capacity to store files and data. If the storage reaches the capacity,it turns out that more space is required for the data storage. The hard drive is a major storage space in a system with large capacity. So, if it gets full, there are various ways it could be increased such as replacing it with other internal hard drive, external hard drive etc.

But installation of the memory card is not the solution for increasing the space because they don't have very large space and can only support small devices.

7 0
3 years ago
Patient letters created from __________ use structured data and do not require a large amount of typing from the medical assista
sladkih [1.3K]
Patient letters created from __________ use structured data and do not require a large amount of typing from the medical assistant.
TEMPLATES
5 0
3 years ago
Read 2 more answers
How can you ensure you don't go over your budget?
Alenkinab [10]
Round up your experience estimates to add a buffer.
3 0
3 years ago
The best technique to read​
Readme [11.4K]

Answer:

The best reading techniques are the SQ3R technique, skimming, scanning, active reading, detailed reading, and structure-proposition-evaluation.

Explanation:

6 0
3 years ago
Other questions:
  • You were replying to e-mail when suddenly your computer started to display random messages, and stopped responding to keyboard a
    10·1 answer
  • What does the shell of a operating system do?
    11·1 answer
  • As you apply to college when should you apply for financial aid
    9·1 answer
  • 12. In Microsoft Word, when you highlight existing text you want to replace, you are in A. basic mode. B. automatic mode. C. ins
    10·2 answers
  • What is the output of the following snippet if the user enters a value of 11 for the variable x and 4 for the variable y? x=int(
    5·1 answer
  • What is an overview of your opinion of Digital Etiquette? Do not look it up bc I will know!
    7·1 answer
  • What do you notice about the cinematography
    14·1 answer
  • Zohan uses the following analogy to describe a concept of object-oriented programming. A button can have many uses. When it is p
    15·1 answer
  • Select the three subjects studied in sports biomechanics.
    9·1 answer
  • Normal view definition
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!