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
PLEASE HELP! I'm offering brainliest!
Marina CMI [18]

Answer:

1. Undo  2. Font Type   3. Font Size  4. Bold Font 5. <em>Italics  </em>6. Word Color  7.  Document Margins

Explanation:

Did you know that all of these answers are how to format a document?

7 0
3 years ago
The Freeze Panes feature would be most helpful for which situation?
sergiy2304 [10]

Answer:

i think a but not so sure

Explanation:

6 0
3 years ago
What's a qat on a computer
suter [353]
The answer is ..........

The Microsoft Quick Access Toolbar (QAT<span>) is a toolbar menu that appears in Microsoft Excel, Microsoft Word, and other Office 2007 and above products in the top left corner of the window. As seen in the picture, the Quick Access Toolbar gives you quick access to commonly used features such as the Save feature.
</span>
hope it helps have a great one! :)
5 0
3 years ago
Read 2 more answers
The this reference . a) can be used implicitly b) must be used implicitly c) must not be used implicitly d) must not be used 25)
Gnom [1K]

Answer:

yeet

Explanation:

because computers

6 0
3 years ago
What is the process for creating a new merge document for address labels?
Archy [21]

Answer:

In Word, click Mailings > Start Mail Merge > Step-by-Step Mail Merge Wizard to start the mail merge wizard. Choose Labels, and then click Next: Starting document. Choose Label options, select your label vendor and product number, and then click OK. Click Next: Select recipients.

Explanation:

6 0
4 years ago
Read 2 more answers
Other questions:
  • Using the merge method of the Map interface, which statement correctly updates the salesTotalByDept map of type Map to update th
    7·1 answer
  • The rmdir command (with no options) can only remove empty directories <br> a. True <br> b. False
    14·1 answer
  • 5 What is the effect of the author proposing athought experiment at the beginning of the text? ​
    5·2 answers
  • Write a function safeOpen() that takes one parameter, filename — a string giving the pathname of the file to be opened for readi
    15·1 answer
  • The greatest common divisor of integers x and y is the largest integer that evenly divides into both x and y. Write a recursive
    7·1 answer
  • Write a statement that compares the values of score1 and score2 and takes the following actions. When score1 exceeds score2, the
    7·1 answer
  • You are an IT technician at your company. The company has two small offices in different cities. The company's head office conta
    5·1 answer
  • Can i eat chicken and you shut
    14·2 answers
  • Type of Factor Beginning Frog Count Simulation 1 (Low) Simulation 2 (High)
    13·1 answer
  • Why is translator required?​
    11·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!