Write a program in C++ using libraries. Write a function that allows case-insensitive comparison of two strings. The return value should be analogous to that from strcmp: s1 < s2 return something < 0 s1 == s2 return something == 0 s1 > s2 return something > 0 (These return values can be short integers.) Just remember that the comparisons are to be done in a manner that ignores the caseof the letters in the strings! But also note that the strings should not be altered at all. Don't change the two string arguments before or during the call. Don't make copies and change the copies. All of this is terribly wasteful and/or destructive of data. Place your new function in a library (strextra?) and call it something useful (strcmp_ncase?). Write a driver program to test your function.

Question

Write a program in C++ using libraries.

Write a function that allows case-insensitive comparison of two strings. The return value should be analogous to that from strcmp:

s1 < s2 return something < 0

s1 == s2 return something == 0

s1 > s2 return something > 0

(These return values can be short integers.)

Just remember that the comparisons are to be done in a manner that ignores the caseof the letters in the strings!

But also note that the strings should not be altered at all. Don't change the two string arguments before or during the call. Don't make copies and change the copies. All of this is terribly wasteful and/or destructive of data.

Place your new function in a library (strextra?) and call it something useful (strcmp_ncase?).

Write a driver program to test your function.

Expert Answer

Want to see the step-by-step answer?

Check out a sample Q&A here.

Want to see this answer and more?

Experts are waiting 24/7 to provide step-by-step solutions in as fast as 30 minutes!*

*Response times may vary by subject and question complexity. Median response time is 34 minutes for paid subscribers and may be longer for promotional offers.
Tagged in
Engineering
Computer Science

Programing Language

Related Computer Science Q&A

Find answers to questions asked by students like you.

Q: Given the C loop: while (x != y) { .. }. Assume x is in $s0 and y is in $s1. Which option should be ...

A: According to the question, the given example of coding in C is as below : while( x != y) { ...........

Q: Answer in both for and while loop.

A: Using the for loop: Program Approach: Including header file and using namespace to get a standard I...

Q: Here is my question that I have from my algorithms' class.  Modify the linear-time an an algorithm f...

A: Step 1:- Note:-There is no programming language is mention therefore i am writing the program in c++...

Q: Please answer sub part b and c.  Question 1 a) What is regression testing? b) When do we do black bo...

A: b) When do we do black box testing? What do we test for in black box testing?   Black box testing is...

Q: Primary U.S. interstate highways are numbered 1-99. Odd numbers (like the 5 or 95) go north/south, a...

A: Note: You didn't mention any programming languages so I use Java  Program: import java.util.Scanner;...

Q: Write a function called reversit () that reverses a C-string (an array of char). Use a forloop that ...

A: Objective: A function needs to be written with the name reversit() to display a C-string using a "fo...

Q: In the construction process while converting to a DFA, do not forget to account for the lambda trans...

A: Actually, Finite Automaton can be classified into two types − Deterministic Finite Automaton (DFA) ...

Q: Hi, I need to solve this problem with C++ programming language using Visual Studio. Thank you.

A: Explanation- Declare four variables . Take input of two numbers from user Find the difference of bo...

Q: can anyone explain the code in the red box?

A: In the given equation, we are transforming each 2d dataset into 3d. For that we use the formula,   ...

Q: Question: Need to add comments to every line. (C++)    #include iostream using namespace std; int ma...

A: length 4;width 8; Here length and width variables are initialized, hence assignment operator needs ...

Q: In C++, write a program that checks whether there are duplicated numbers within three user inputted ...

A: PROGRAM: //Header files #include &lt;iostream&gt;   //Using namespace using namespace std;   //Defin...

Q: Need Help solving this in C++ language .   Prompt for and get the user’s number of donuts to buy and...

A: In this program, you need to take input from user for number of donuts and number of people. After t...

Q: Please answer with explanation.

A: Given: Register programming with binary shift notation with two variables.  Objective: The value sto...

Q: Which methodology, Agile or waterfall, do you think is most appropriate for a project characterized ...

A: AGILE FRAMEWORK: Agile framework is that software development phase which has the ability to respon...

Q: Name three different data types and provide real-world examples of how you would use them within an ...

A: Datatypes: Datatype is a set of values and each datatype have its own purpose. Datatype shows the t...

Q: Discuss two advantages and disadvantages of Integrated Enterprise Information Systems. Illustrate yo...

A: Integrated Information System(IIS): It is the collection of multiple information sets that are organ...

Q: The dealer’s cost of a car is 85% of the listed price. The dealer would accept any offer that is at ...

A: Objective: To design an algorithm that prompts the user to input the price of the car and display th...

Q: The Big State University course catalogue reads as follows: “To enroll in MIS 260, which is an advan...

A: Decision table: - It is the logical representation which shows every combination of all the conditio...

Q: Hello, I have a few questions in regards to MYSQL. It was answered on the website before, but whenev...

A: Stored procedures: A procedure is a collection of procedural and SQL statements. A procedure may h...

Q: When is Excel acceptable to build a table in Word instead of using a spreadsheet tool like Excel? Wh...

A: Part a) An Excel accept to build a table in Word in the following scenarios: When a user wants to gr...

Q: Fill in the empty spaces in the following table and be aware of the following: • All answers must ha...

A: Click to see the answer

Q: Considering the 3 categories of metadata, give specifics examples of each for an electronic medical ...

A: Metadata: Meta data is data about data that provides detailed information regarding each and every o...

Q: With a fancy calculator, finding square roots is easy. But what if you only had a basic four-functio...

A: Algorithm: The algorithm is a step by step process, defining a series of directions to be carried ou...

Q: What does the %C&amp;A metric measure in the Continuous Delivery Pipeline? The percent of time downs...

A: Percent Complete and Accurate (%C&amp;A) is obtained by questioning the downstream customers about w...

Q: Modify songVerse to play "The Name Game" (OxfordDictionaries.com), by replacing " (Name)" with userN...

A: Program with modified “songVerse” to play “The Name Game” by replacing “(Name)” with “userName” but ...

Q: Good Practice Example: Best Practice in Project?

A: Project management: The ability to plan the budget, list the resources and identify the cost of av...

Q: 341 and 3640  How many bits are required to store this number?explain How do you find it and show yo...

A: Integers are stored in using the word memory. This word is equal to 4 bytes or 32 bits. So, the inte...

Q: Using Excel, build a decimal to 8-bit binary converter. Do not use any Excel functions except for IF

A: Formula: =IF(B3=1,128,0)+IF(C3=1,64,0)+IF(D3=1,32,0)+IF(E3=1,16,0)+IF(F3=1,8,0)+IF(G3=1,4,0)+IF(H3=1...

Q: b. Write a C+ program to calculate and display the average of each group of numbers in the file crea...

A: The program will open the file using the code myfile.open("input.txt"); There are two loops in the p...

Q: QUESTION 8 I do the following: o "Listen" to on/off switches and sensors • "Talk" to the CPU • Conve...

A: Step 1:- Note:-I am giving the answer of Question no 8 on the bases of the remote rack which is aske...

Q: Hello! I need to answer this question. The book is: "Computer Security and Penetration Testing e2". ...

A: Sniffing :  When you transfer data to someone, it is broken down into small units called data packet...

Q: Hi, I need to answer this question. Which is from "Hacker Techniques, Tools, and Incident Handling 3...

A:  The cybersecurity cloud labs for Hacker Techniques, Tools, and Incident Handling 3e".

Q: Suppose in an implementation of STACK supports an instruction REVERSE which reverses the order of th...

A: A linear structure where activities happen with some specific operations are known as stack. The ope...

Q: I need softwares to detect data leake with any techniques, anyone can help me?

A: Several techniques such as content matching, image recognition, fingerprinting, and statistical anal...

Q: ERP or Enterprise Resource Planning system has both automated and manual risks.  How do we control t...

A: Enterprise Resource Planning System implementation is both an art and science that consists of plann...

Q: Please help me with the solution:INSERT INTO LINE VALUES('1001','1','123-21UUY','1','189.99'); INSER...

A: Seems like you accidentally copied data for table line from another question.  So, I am Implementing...

Q: Hello, I need to solve this problem with C++ programming language using Visual Studio. Thank you.

A: Open visual studio. Select File -&gt; New -&gt; Project. Select Visual C++ -&gt; Console App. Type n...

Q: Please help to answer this question!

A: Hey, since multiple sub part questions posted, we will answer first three question according to our ...

Q: Print "userNum1 is negative." if userNum1 is less than 0. End with newline. Assign userNum2 with 4 i...

A: 1. Take two inputs from the user. 2. Write the if condition for userNum1. 3. Write the if condition ...

Q: How a teacher connect with other teachers on Edmodo?

A: Connecting with other teachers on EdmodoEdmodo is an educational website which takes the ideas of a ...

Q: Write a program that informs a user of their meal charge. Create a variable to hold the meal charge ...

A: Since the language is not mentioned therefore writing the code in C : #include&lt;stdio.h&gt;int mai...

Q: Describe the fundamental structures used in operating system file organisation.

A: The fundamental structures used in operating system file organization: File Block : At the basic l...

Q: ((A – B – C) U (B – A – C) U (C – A – B) – (AN B N C)

A: Click to see the answer

Q: Write a problem that counts the number of words in a sentence input by the user. Save it as words.py...

A: Justification: You are getting this error because, indentation of the code (from 4th line) is not do...

Q: Define project, project life cycle, and software development life cycle. How does a project’s softwa...

A: Project: A project refers to a well-planned set of activities that need to be accomplished under cer...

Q: Complete the given Car class with set, get,and display functions as well as a constructor that accep...

A: The following instructions are needed to write the program for the class Car: Include the header fi...

Q: How to code for user input in Java programming language?

A: In Java Programming Language, The scanner class is used to get user input.

Q: Convert each decimal number to octal 45.8 12478.3

A: PROCEDURE: To convert a decimal number to octal form following steps are used: If the number is le...

Q: Write and test PHP scripts for the two exercises that follow, debug (if necessary).  When required t...

A: What is PHP: PHP stands for Hypertext Pre-Processor. PHP is a scripting language used to develop sta...

Q: It's a very nice application of stacks. Consider that a freight train has n railroad cars. Each to b...

A: I will be using Jupyter Notebook to illustrate the code: