Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

LANGUAGE C++ Write a function that allows case- in sensitive comparison of two strings. The strings should not be altered at all. The return value

LANGUAGE C++

Write a function that allows case-insensitive comparison of two strings. The strings should not be altered at all. 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!

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

Write a driver program to test your function.

Add two defaulted arguments to your function which will allow the caller to request that you skip spaces and/or skip punctuation when doing the comparison.

Have numbers sorted properly even when they aren't justified with leading 0's:

 1 2 ... 9 10 

Instead of:

 1 10 2 ... 9 

Have numbers sorted properly even if they aren't in the lead of the string:

 a1 a2 ... a9 a10 b1 b2 ... 

Instead of:

 a1 a10 a2 ... a9 b1 b10 b2 

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions

Question

Recognize that stress is necessary for life.

Answered: 1 week ago

Question

The reason for eliminating the price change in inventory is:

Answered: 1 week ago

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago