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 shouldnotbe altered at all. Thereturnvalue should be analogous to that fromstrcmp:

s1 >>

s1 == s2 return something == 0

s1 > s2 return something > 0

(Thesereturnvalues can beshortintegers.)

Just remember that the comparisons are to be done in a manner thatignoresthe 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 leading0'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

Pro Android Graphics

Authors: Wallace Jackson

1st Edition

1430257857, 978-1430257851

More Books

Students also viewed these Programming questions