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
How were the pages made to create the Book of Kells? a. Scribes prepared the papers using a printing press. b. 185 calves were s
NeX [460]

Answer:

The answer is "Option b".

Explanation:

This is the book of the liturgical manuscript for the catholic churches, which is the four Scriptural texts now in Cambridge, Dublin, and Ireland. It is the job, which is known for the sophistication, accuracy, and elegance of that same paintings in the Classically illustrated scripts. It was been built between 800 AD by Celtic monks to build vellum 185 calves had been killed, and the incorrect option can be defined as follows:

  • In option a, This book is not used in the printing press.
  • In option c, This book is used in the liturgical manuscript.
7 0
3 years ago
Easy coding question, please help.
borishaifa [10]

Answers:

What is the index of the last element in the array? stArr1.length()-1

This prints the names in order. How would I print every other value? Change line 4 to: index = index +2

Change line 7 to: i < names.length

5 0
2 years ago
Nila has created a report, and now she would like to a create table of contents. Nila has reviewed her report and decides to add
Alenkinab [10]

Answer:

The answer is "heading"

Explanation:

Headings, which appear into your document must be marked simply, objectively and correctly because it shows the final report structure and enable to easy access with specific information.  

  • It also promotes to read the document. So, its consistency is ensured in the headings.
  • In sort documents, it can't require any heading, but it Nila created a report, in which she requires  heading and then she update the content of the tables, and other choices can't be described in the given scenario, that's why it is correct
5 0
3 years ago
A __________ note is a private note that you leave for yourself or for other people who might use the presentation file
BaLLatris [955]

Answer:

The answer is that it is a speaker note.

Explanation:

It leaves a note for people that use presentation files. I use it all the time on my google slides.

7 0
2 years ago
Moving your Sprite top to bottom is moving along the X coordinate?
Marianna [84]
The answer is false
6 0
3 years ago
Other questions:
  • Any software or program that comes in many forms and is designed to disrupt the normal operation of a computer by allowing an un
    13·1 answer
  • Which windows tool can you use to find out if the hard drive is slowing down windows performance?
    9·1 answer
  • Frank is a writer. He needs to work for long hours and type for long periods on the computer. What injury can Frank develop?
    15·2 answers
  • Identify the layout in which you will be able to view and edit the header and footer
    12·1 answer
  • Kyle asked his supervisor which type of computing model was used when the enterprise first started. She explained that the organ
    14·1 answer
  • If you’re paid hourly and work 40 hours in one week how much overtime have you worked? 8 hours none $48 or $80
    9·2 answers
  • I have a very quick question. So im applying for Early college and i need some future educational goals and maybe im just thinki
    6·1 answer
  • You attempt to telnet to system 192.168.1.240. You receive the following message: "Connecting To 192.168.1.240...Could not open
    5·1 answer
  • What are the characteristics of calendar sharing options in Outlook 2016? Check all that apply.
    13·2 answers
  • Jiwoo is a professional photographer. Identify and describe a photography scenario where Jiwoo would need to consider the ethics
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!