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
Naddik [55]
3 years ago
8

C++

Computers and Technology
1 answer:
kotegsom [21]3 years ago
8 0

Answer:

a) # include <iostream>

# include <conio.h>

# include <stdio.h>

# include <string.h>

using namespace::std;

bool IsPalindrome(const string& str)

{

   if (str.empty())

       return false;

   int i = 0;                // first characters

   int j = str.length() - 1; // last character

   while (i < j)

   {

     

       if (str[i] != str[j])

       {

           return false;

       }

       i++;

       j--;

   }

   return true;

}

int main()

{      

      string str;

      cout<<"Enter the string";

      getline(cin, str);

      bool a= IsPalindrome(str);

      if(a)

      {

          cout<<"Is in palindrome";

      }

      else

      {

          cout<<"Is not in palindrome";

      }

}

b) Modified version of function with full program to discard uppercase or lowercase is as below:

# include <iostream>

# include <conio.h>

# include <stdio.h>

# include <string.h>

using namespace::std;

bool IsPalindrome(const string& str)

{

   if (str.empty())

       return false;

   int i = 0;                // first characters

   int j = str.length() - 1; // last character

   while (i < j)

   {

       char a= tolower(str[i]);

       char b= tolower(str[j]);

       if (a != b)

       {

           return false;

       }

       i++;

       j--;

   }

   return true;

}

int main()

{      

      string str;

      cout<<"Enter the string";

      getline(cin, str);

      bool a= IsPalindrome(str);

      if(a)

      {

          cout<<"Is in palindrome";

      }

      else

      {

          cout<<"Is not in palindrome";

      }

}

Explanation:

Please check the answer section.

You might be interested in
Which THREE devices can perform both input and output operations?
Andru [333]

Answer:

nic card,speakers,router

4 0
4 years ago
Read 2 more answers
Why is the cpu the most important component in a computer?
german
CPU (Central Processing Unit) is also known as the brain of the computer because this is the place which actually runs the programs. The programs are the set of instructions needed to perform a task.
4 0
3 years ago
Describe how computer is in the last 35 years
lesantik [10]
Earlier there were no ic's but vacuum tubes or  transisters,..
making computer big , so big in that time, with low speed and  memory
4 0
4 years ago
Help please, on tuesday we have oral presentation in zoom and i am afraid to speak in front of people, and i don't know what to
Lapatulllka [165]

Answer:

You should be strong, and be sure about what you want to say. Make sure when you speak it is clear, and makes sense.

Explanation:

If you don't speak up or sound like you know what you are talking about. I like to think of it as dancing. Act like you own the stage, or in your case, like you own the presentation. Also, I suggest you speak to your teacher in private, about him ignoring you. If I were you, I would look for newer friends. Ones that won't ignore you.

6 0
3 years ago
Given an int variable datum that has already been declared, write a few statements that read an integer value from standard inpu
Zina [86]

Answer:

Following are the  Statement in the Java Language .

Scanner out = new Scanner( System.in); // creating the object

datum = out.nextInt(); // Read the integer value bu using the instance of scanner class

Explanation:

In the Java Programming Language The scanner class is used for taking the user input from the standard input The definition of scanner class is java.util package means that if you taking the input by using scanner class firstly importing the predefined package i.e Java.util.

The description of the above code is given below

  • Scanner out = new Scanner( System.in);: This statement created the instance "out" of the scanner class which is used for taking the input.
  • datum = out.nextInt(); : This statement taking the integer input and store them into the datnum variable.
3 0
4 years ago
Other questions:
  • Which description best describes how mass spectroscopy is useful in the field of forensic toxicology
    6·1 answer
  • Which group on the Home Ribbon allows you to add shapes to a PowerPoint slide?
    10·2 answers
  • Your company has 1,000 users in a Microsoft Office 365 subscription. A Power BI administrator named Admin1 creates 20 dashboards
    14·1 answer
  • write a Program which displays at least 5 different sentences that explain how technology has been used to win souls to Christ.
    6·1 answer
  • Suppose that the following elements are added in the specified order to an empty binary search tree: Lisa, Bart, Marge, Homer, M
    5·1 answer
  • What is the difference between the throw statement and the throws clause?
    10·1 answer
  • Alicia uses a software application to store the names, email addresses, and phone numbers of her friends in alphabetical order. 
    11·1 answer
  • Full form of DVX please answer fast ​
    9·1 answer
  • You can use _____ to track the state of each user in the application.
    8·1 answer
  • What relationship do MP3s and MP3 players have with video files?
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!