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
Alexandra [31]
3 years ago
4

The is_palindrome function checks if a string is a palindrome. A palindrome is a string that can be equally read from left to ri

ght or right to left, omitting blank spaces, and ignoring capitalization. Examples of palindromes are words like kayak and radar, and phrases like "Never Odd or Even". Fill in the blanks in this function to return True if the passed string is a palindrome, False if not.
Computers and Technology
1 answer:
Dafna1 [17]3 years ago
3 0

Answer:

#include <iostream>  

using namespace std;  

   

// To check String is palindrome or not  

bool Palindrome(string str)  

{  

   int l = 0, lenght = str.length();  

   

   // Lowercase string  

   for (int i = 0; i < lenght; i++)  

       str[i] = tolower(str[i]);  

   

   // Compares character until they are equal  

   while (l <= lenght) {  

   

       if (!(str[l] >= 'a' && str[l] <= 'z'))  

           l++;  

   

       else if (!(str[lenght] >= 'a' && str[lenght] <= 'z'))  

           lenght--;  

   

       else if (str[l] == str[lenght])  

           l++, lenght--;  

   

       // If characters are not equal(not palindrome ) then return false

       

       else

           return false;  

   }  

   

   // Returns true if sentence is equal (palindrome)  

   return true;  

}  

   

int main()  

{  

   string sentence;  

   getline(cin, sentence) ;  

   if (Palindrome(sentence))  

       cout << "Sentence is palindrome.";  

   else

       cout << "Sentence is not palindrome.";  

   

   return 0;  

}  

Explanation:

You might be interested in
The output for the following code will be: Pasta (1 mark)
Anastasy [175]

Answer:

The output is "Pasta"

Explanation:

Given

The attached code segment

Required

The output

The first line of the program implies that:

MyFavFood="Pasta"

This means that, the value of the variable MyFavFood is string "Pasta"

Next,

print (MyFavFood)

This prints the value of the variable MyFavFood which is "Pasta"

<em>Hence, the output is "Pasta"</em>

7 0
3 years ago
13. A 2-sided coin has an equal likelihood of landing on each side. One side is called "heads" and the other is called "tails".
serious [3.7K]

Answer: c

Explanation:

only reasonable answer

7 0
3 years ago
PLZ ANSWER ALL MY QUESTION. Which line of code will display the variable num rounded to the nearest tenth?
zavuch27 [327]

Answer:

A

Explanation:

5 0
3 years ago
Each symbol of an octal number corresponds to 3 bits of a binary number. is it true or false​
grin007 [14]

Answer: True.

Explanation: It uses only the 3 bits to represent any digit in binary and easy to convert from octal to binary and then to vice-versa. Hope that helps

5 0
3 years ago
Create a for-loop which simplifies the following code segment: penUp(); moveTo(100,120); turnTo(180); penDown(); moveForward(25)
kvasek [131]

Answer:

for(var i=0; i<3; i++) {

  penUp();

  moveTo(100,120);

  turnTo(180);

  penDown();

  moveForward(25);

}

Explanation:

The i variable is the loop dummy. The code block will be executed 3 times.

7 0
3 years ago
Other questions:
  • What is tuple and attribute of a relation​
    11·1 answer
  • How is sharepoint used in organization today?
    12·1 answer
  • Which is the correct description of the first act in a classical game story structure?
    14·1 answer
  • In a chassis, the path along which air from a cool air source is conducted, past equipment to cool it, and then out of the rack.
    13·1 answer
  • 1) List at least five smaller behaviors you could break the complex behavior "brushing my teeth" into.
    14·2 answers
  • CPU BENCHMARKS are measurements used to compare performance between processors
    9·1 answer
  • Write a recursive function that returns true if the digits of a positive integer are in increasing order; otherwise, the functio
    15·1 answer
  • In terms of CPU scheduling metrics, __________ is the time at which the job completes minus the time at which the job arrived in
    10·1 answer
  • HI How are you anyways are any of you intreseted in my giveaway
    7·2 answers
  • Why When I change my pfp It be blurry and it be ugly- if you know what I mean :c
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!