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
CAN SOMEONE PLEASE HELP ME WITH THIS PLEASE ?!!!!!!!!
kherson [118]
Get feedback about your product from the restaurant
7 0
3 years ago
Francis has designed a picture book appropriate for third graders. He wants teachers across the world to freely download use, an
mestny [16]

Answer:

The correct answer will be "Project Gutenberg".

Explanation:

  • Project Gutenberg continues to obtain lots of requests for authorization for using printed books, pictures, as well as derivatives from eBooks. Perhaps some applications should not be produced, because authorization would be included in the objects provided (as well as for professional usages).
  • You can copy, hand it over, or m actually-use it underneath the provisions including its license that was included in the ebook.

So that the above is the right answer.

8 0
3 years ago
What is the advantage of using standards to develop and implement protocols?
snow_lady [41]

Products from different manufacturers can interoperate successfully.

6 0
3 years ago
Which of the following best describes Vivofit’s purpose?
Daniel [21]
The vivofit by Garmin is a fitness tracker that not only tracks distance, calories burned, and steps — it lasts on one charge for an entire year. Slap it on your wrist and never worry about charging it.
5 0
3 years ago
What is the device that converts the signals to and from the wires so that the data can be sent and received by the computer?
netineya [11]

Answer:

E. Modem

Explanation:

A network comprises of two or more interconnected devices such as computers, routers, switches, smartphones, tablets, etc. These interconnected devices avail users the ability to communicate and share documents with one another over the network.

In order for a network to exist or be established, the devices must be turned (powered) on and interconnected either wirelessly or through a cable (wired) connection.

In Computer Networking, a node is the physical device that make up a network and are capable of sending, receiving, creating and storing data in communication.

Examples of network nodes are routers, hubs, computer, switches, smartphone, printers, modem, etc.

A modem is a networking device that converts the signals to and from the wires such as a telephone line, so that the data can be sent and received by the computer.

Basically, a modem is an abbreviation for modulator and demodulator and as such it is designed to convert signal from one network device to signals that another network device such as a computer can understand or read.

When sending a signal (data) over a network, a modem converts (modulate) digital data signal to an analogue signal and transmits it over a telephone line or other communication lines. Also, when receiving an analogue signal, a modem converts (demodulate) the signal to a digital data signal.

8 0
3 years ago
Other questions:
  • Reading is the process of transferring data, instructions, and information from memory to a storage medium.
    15·1 answer
  • Its false because I got it wrong
    5·1 answer
  • Write a statement that declares a PrintWriter reference variable named output and initializes it to a reference to a newly creat
    5·1 answer
  • Suppose an initially-empty queue Q has performed a total of 32 enqueue operations, 10 front operations, and 15 dequeue operation
    14·1 answer
  • An internal _____ refers to a specific representation of an internal model, using the database constructs supported by the chose
    8·1 answer
  • Write a function stats that takes an array and the number of elements in the array. Then, it computes and prints the minimum val
    8·1 answer
  • Where is the quick access toolbar located?
    7·1 answer
  • I need to create a method named "root positive". which will either print the square root of the number passed to it or if the nu
    13·1 answer
  • For this program you will build a simple dice game called Pig. In this version of Pig, two players alternate turns. Players each
    6·1 answer
  • What would the theoretical variance (square of the standard deviation) of the following random values be? rand(Normal(80, 10), 2
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!