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
Write a program that reads in an integer, and breaks it into a sequence of individual digits. Display each digit on a separate l
Montano1993 [528]

Answer:

The program in Python is as follows:

num = int(input())

for i in str(num):

   print(int(i))

Explanation:

This gets input for the number

num = int(input())

This converts the number to string and iterates through each element of the string

for i in str(num):

This prints individual digits

   print(int(i))

4 0
2 years ago
The name of a Variable effects its value<br><br> True<br><br> False
Y_Kistochka [10]

Answer:

option A ) true is right answer.

7 0
3 years ago
Select the correct category of cybersecurity described.
Shalnov [3]

Answer:

Network security

Explanation:

Network security is a category of cybersecurity that is related to the protection of the infrastructure of the computer network from unauthorized access and intrusion that may be from intended attack or from an expedient  program which may result in the modification, malfunctioning, misuse or unacceptable disclosure of the network and the contents of the network

The category of cybersecurity that 'prevents intruders from accessing, misusing, destroying, adapting, or improperly disclosing networks, network infrastructure, or the information contained within networks' is network security.

6 0
2 years ago
Jed is the database administrator for a mid-sized computer component manufacturer. He is responsible for validating the data mod
svet-max [94.6K]

Answer:

Development task is the correct answer to the given question.

Explanation:

The database administrator is responsible for managing the database management system . The overall security of the database is depended on the database administrator.

The Development task include the following function  

  • Verification of the data model that is used by the database management system .
  • Check the user input it means validating the data.
  • Defining the overall requirement to create the model.
  • Providing backup when the data is loss .

So the Development task is the correct answer.

3 0
3 years ago
What is log in and log out?
Brums [2.3K]
Log in is the feature that allows you to access your electronic account in a website, database or other, also a bank account. Your username and password are stored in cookies  (files that websites use and are stored in your browser) for the session. This is true if we talk about websites.

When you're done, you log out from your account, you disconnect. Cookies are cleared (for websites) and you're out.
8 0
3 years ago
Other questions:
  • It takes an older computer twice as long to send out a company's email as it does a newer computer. Working together, it takes t
    15·1 answer
  • The internet connects millions of computers connected through millions of ____ worldwide.
    9·1 answer
  • Fill in the correct formula called a contains numbers from Rhodes 1 to 20 you can use the formula blank to find the volume of th
    14·1 answer
  • How do I use this without the spring?
    6·1 answer
  • Which term means a device that converts one voltage to another?
    13·1 answer
  • After conducting interviews with several bad candidates, Althea, a manager at Langrover Inc. interviewed a candidate who was bet
    15·1 answer
  • Cuantos MB son 8,192 kb?​
    13·1 answer
  • with the advent of technology one can experience special features such as 3D theater experiences true or false
    8·1 answer
  • Suppression of politically or socially unacceptable co
    5·1 answer
  • Can somebody please help me with these few questions?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!