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
Wi-Fi is designed for medium-range transfers, up to ____ feet outdoors. Answer 100 300 500 900
Papessa [141]
Wi-Fi is designed for medium range transfers up to 900 feet out doors. ANSWER: 900 feet
6 0
4 years ago
What is a coaxial cable?
grin007 [14]

Answer:

A transmission line that consists of a tube of electrically conducting material surrounding a central conductor held in place by insulators and that is used to transmit telegraph, telephone, television, and Internet signals.

Coax, short for coaxial, is a type of cable used to transmit data, the internet, video and voice communications. A coax cable is made up of an aluminum and copper shield with an outer plastic jacket (see below) with the dielectric insulator helping to minimize signal loss.

5 0
2 years ago
Given f(x) = -2x2 + 5x - 1 and g(x) = 3x + 4 determine a simplified
lukranit [14]

Answer:

-6x^4 + 7x^3 + 17x^2 -4x

Explanation:

( f x g )( x )

Substitute

[( -2x^2 + 5x -1 )( 3x + 4 )]( x )

Use the Distributive Property

[-2x^2( 3x) + 5x( 3x) - 1( 3x) -2x^2( 4) + 5x (4) -1 (4)] (x)

Simplify

( -6x^3 + 7x^2 + 17x -4)(x)

Distributive Property

-6x^4 + 7x^3 + 17x^2 -4x

7 0
3 years ago
Que implicaciones sociales puede tener la robótica
wolverine [178]
Según estos estudios, el impacto de los robots en la productividad ya se compara con la contribución de las máquinas de vapor en el pasado. ... Algunos de los aumentos en la productividad que se derivan de la densificación de los robots se comparten con los trabajadores mediante el pago de salarios más altos.
8 0
3 years ago
you are troubleshooting an inkjet printer . users report that the printer is printing in the wrong colors. the problem just star
monitta

The likely cause of the printer printing in the wrong colors includes:

  • Ink cartridges installed in the wrong spot
  • leaking ink cartridges

<h3>What is a inkjet printer?</h3>

This refers to a computer peripheral that produces hard copies of a text document or photo by spraying droplets of ink onto paper.

In conclusion, the likely cause of the printer printing in the wrong colors includes ink cartridges installed in the wrong spot and leaking ink cartridges.

Read more about inkjet printer

brainly.com/question/4962501

#SPJ4

6 0
2 years ago
Other questions:
  • A sentinel value ________ and signals that there are no more values to be entered:____
    14·1 answer
  • Sorting table rows is based on the data in the selected        A. cell range.   B. cell.   C. column.   D. row.
    12·2 answers
  • Create an application for a library and name it FineForOverdueBooks. TheMain() method asks the user to input the number of books
    7·1 answer
  • The stream cipher described in Definition 2.1.1 can easily be generalized to work in alphabets other than the binary one. For ma
    10·1 answer
  • To obtain the desired speedup, make sure your new function recursively calls itself no more than once in the body of the method.
    8·1 answer
  • My speaker on my phone is not working, when I try and play music and videos the sound dosen't work. However my alarm works. Can
    9·2 answers
  • When preparing the heading for an MLA Format Academic Report, which of the following shows the proper order of the for lines of
    10·1 answer
  • Is a defense of a political position an argument
    7·1 answer
  • What is technology in computer​
    6·1 answer
  • Which of the following are pointers?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!