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
A skier provides what in a landscape photograph of a mountain?
liraira [26]
I think it may be D but all of them sound pretty important to get the perfect photo.  I tried researching and each website told me different.<span />
7 0
2 years ago
Read 2 more answers
Which page layout is most commonly used for a website with a large navigation menu?
mestny [16]

Explanation:

The Name is called, (navigation menu..)

to direct users 2 info., they look up...

7 0
2 years ago
What are the things that a computer literate understands?Name thems.​
vitfil [10]

Answer:

•Determine your IP address.

•Verify physical connectivity to the network.

•Check that you have a logical connection to the network.

•Find out what path network traffic takes to get to its destination.

Translate from DNS names to IP addresses.

4 0
2 years ago
Privacy a. is an absolute value so corporate interests cannot be considered when it comes to employee privacy. b. is guaranteed
zmey [24]

Answer:

C. Must be respected if we are to function as complete, self-governing agents.

Explanation:

<em>Privacy</em> is the boundaries that are set up to protect us against unwanted intrusion or interference, and it forms the basis of our interaction with the world.

<em>Privacy laws</em> are set-up to protect individuals from unwanted and unapproved access to privacy by individuals, organizations, and government. This is greatly adhered to in many countries.

To some extent, privacy is considered to overlap with security, because, when private information such as social security number, bank card details, account names, and details, etc. are accessed inappropriately, the individual's security is greatly compromised.

Therefore, privacy must be greatly respected if we are to function as complete, self-governing agents.

8 0
3 years ago
This graph shows a relationship between the height of a giraffe and its weight which term describe the dashed line through the g
Nadusha1986 [10]

Answer: The Answer is C

Explanation: This is because It is mainly controlled by genetics and we can not manipulate genetics.

4 0
3 years ago
Read 2 more answers
Other questions:
  • What is a block cipher algorithm that operates on 64-bit blocks and can have a key length from 32 to 448 bits?
    8·1 answer
  • Why are advanced features helpful when businesses use spreadsheets
    5·1 answer
  • In CadStd, what does the Zoom All button do? A. Makes a drawing bigger so you can see small details B. Returns a drawing to a si
    5·1 answer
  • CHALLENGE ACTIVITY 4.2.2: Basic while loop with user input. Write an expression that executes the loop while the user enters a n
    14·1 answer
  • Ciscon Telecom is a mobile operator in the European Union. The company provides personalized services to its customers, and its
    8·2 answers
  • which of the following is another term for a variable, such as cost or schedule, that limits the freedom of design, development,
    11·1 answer
  • Do you think communities or countries can survive without the internet?why or why not?​
    11·1 answer
  • When all the system testing and bugs correction has done, the software product will be delivered to the user for __________.
    15·1 answer
  • H e l p ASAP plz <br> and thanks
    9·1 answer
  • On his website, Mario has a video that visitors must click to play. He wants the video to play automatically when the page loads
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!