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
The first step in the information processing cycle is _____, which involves entering data into the computer.
Dmitry [639]

Answer:

INPUT

Explanation:

Information Processing Cycle is defined as the series of stages followed in processing information. Those stages include:

  • Input
  • Processing
  • Storage
  • Output

Input involve entering the data/information into the computer

Processing involve the computer performing some computation on the data

Storage involve saving the data and/or result to the any medium for future use.

Output involve displaying or presenting the results to the user.

4 0
3 years ago
When you insert a photo into a document, its placed at the ​
Ray Of Light [21]

either in the doc its self or in the attachment file

5 0
3 years ago
Read 2 more answers
Which of the following is the primary medium for beach erosion?
Serhud [2]
The answer is C. I think.
4 0
3 years ago
which classification of money describes money that can be accessed quickly and easily, and includes coins and paper money as wel
zhenek [66]

Money that can be promptly and easily appraised falls under the M1 Money classification.

<h3>What are broad and narrow money, respectively?</h3>

Broad money typically refers to M2, M3, and/or M4. The most liquid kinds of money, such as currency (banknotes and coins), as well as bank account balances that may be instantly changed into currency or used for cashless transactions, are generally referred to as "narrow money" (overnight deposits, checking accounts).

<h3>Describe Narrow Money.</h3>

All of the actual money that the central bank has falls under the category of "narrow money," which is a subset of the money supply. Demand deposits, money, and other liquid assets are included. In the US, "narrow money" is referred to as M1 (M0 plus demand accounts).

To know more about Money classification visit:-

brainly.com/question/28095328

#SPJ1

5 0
1 year ago
A device that filters data traffic at a network boundary​
Semmy [17]

Answer:

Bridges

Explanation:

A bridge is a transition effects that separates network traffic at the network's edge. By splitting a local area network into two parts, bridges minimise the number of bandwidth.

6 0
3 years ago
Other questions:
  • What is the maximum number of hosts you can have on a network if the first decimal value of the ip address is between 192 and 22
    10·1 answer
  • What should be included as part of the approval process? in relation to computer forensics
    14·1 answer
  • While doing online research you enter this keyword search with a truncation character: man* Which of the following would not be
    15·1 answer
  • A network slows down when a network card is locked in a perpetual mode
    12·2 answers
  • Two routers connect with a serial link, each using its S0/0/0 interface. The link is currently working using PPP. The network en
    6·1 answer
  • "The ability to assign system policies, deploy software, and assign permissions and rights to users of network resources in a ce
    7·1 answer
  • In this lab you will learn about the concept of Normal Forms for refining your database design. You will then apply the normaliz
    15·1 answer
  • Which line of code outputs the decimal portion of a float stored in the variable x? print (x % 1000) print (x) O print (x / 1000
    13·1 answer
  • Gabriel's sister called him about a message that suddenly appeared on her screen that says her software license has expired and
    11·1 answer
  • PLS HEEELLLP ASAP, DONT JOKE
    9·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!