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
erma4kov [3.2K]
3 years ago
5

C++ a. Write a program that uses the function isPalindrome given in example 6-6 (Palindrome). Test your program on the followinn

g strings: "madam", "abba", "22", "67876", "444244", and "trymeuemyrt" b. Modify the function isPalindrome of example 6-6 so that when determining weather a string is a palindrome, cases are ignored, that is, uppercase and lowercase letters are considered the same. Example 6-6: 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:
Whitepunk [10]3 years ago
5 0

Answer:

#include <iostream>

#include <array>

using namespace std;

bool isPalindrome(string str)  

{  

int length = str.length();  

for (int i = 0; i < length / 2; i++)  

 if (toupper(str[i]) != toupper(str[length - 1 - i]))

  return false;  

return true;  

}

int main()

{

array<string, 6> tests = { "madam", "abba", "22", "67876", "444244", "trymEuemYRT" };

for (auto test : tests) {

 cout << test << " is " << (isPalindrome(test) ? "" : "NOT ") << "a palindrome.\n";

}

}

Explanation:

The toupper() addition forces characters to uppercase, thereby making the comparison case insensitive.

You might be interested in
Write a program that prompts for a positive integer and prints the factors of all integers from 1 to that input integer. For exa
xeze [42]
74(Frequency) or 34(frequency)
7 0
2 years ago
Identity theft, where people steal personal information, continues to be a problem for consumers and businesses. Assume that you
svetlana [45]

Answer:

Secure the personal information with complex multi-factor authentication and configure intrusion detection and prevention and a firewall.

Explanation:

Multi-factor authentication is a method of securing a client's personal information from the client's side to the data centre. It uses more than one security processes not policies. There key be three authentications process like a password, security token and biometrics or two authentications like password and biometrics or token.

The firewall and intrusion detection and prevention are vulnerability preventive method to detect and stop cyber attacks.

5 0
3 years ago
Adding _____ will allow the user to create text as it will often appear in publications with multiple articles, such as a newspa
mart [117]
Does applications make sense <span />
5 0
3 years ago
Read 2 more answers
In PowerPoint, a type of chart that, rather than showing numerical data, illustrates a relationship or logical flow between diff
Lynna [10]

Answer:

A. SmartArt

Explanation:

SmartArt is a graphical tool used to visually communicate information.

8 0
3 years ago
PLEASE BE CONFIDENT ABOUT YOUR ANSWER
Zigmanuir [339]

Answer: d. should be lowercase.

Explanation:

ID attributes are case sensitive for the most part - DOM and Java Script - which means that the ID attribute does not always have to be lowercase.

It can be uppercase as well. ID attributes can also start with a number and as of HTML 5 can start with a special character as well. Finally, the ID attribute must always be unique within each document.

8 0
3 years ago
Read 2 more answers
Other questions:
  • Which of these is a weakness of written communication?
    8·1 answer
  • If your network subnet mask is /16, what is the maximum number of host ids available for this network?
    15·1 answer
  • Which is a description of phishing?
    7·1 answer
  • USDA-APHIS Animal Care Resource Policy #12 "Considerations of Alternatives to Painful/Distressful Procedures" states that when a
    11·1 answer
  • To complete this quest, answer the following questions in the submission box below. Make x an array going from 0 to 100 by steps
    15·1 answer
  • Whats an MAR? lolz better not take my points #bonkers
    12·2 answers
  • Assume there are two variables, k and m, each already associated with a positive integer value and further assume that k's value
    13·1 answer
  • This is a tableware use to serve the main dish
    11·1 answer
  • Help my sister with social studies plssssss its about presidents!!
    9·2 answers
  • 1. What is hydrolics?​
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!