anonymous
2009-11-04 07:41:59 UTC
The function returns 0, -1, 1 if the n-character portion of
s1 is equal to, less than or greater than the corresponding n-character portion of s2, respectively.
You must use the following function header:
int strNcompare(const char *s1, const char *s2, int n)
*. Do not use any string-manipulation functions of C++ library in your program. So your program can include only
*. Do not use any array subscripting notation in the function strNcompare. You must use pointers and pointer arithmetic.
Write a program that receives the number of characters and two words for comparison, and then shows the result.
** sample input/output 1 **
How many characters do you want to compare? 3
Enter two words: tommy tomato
tommy is equal to tomato
What I've done so far:
#include
using namespace std;
void strNcompare(const char *s1, const char *s2, int n);
main (){
cout<<"How many characters do you want to compare?"<
Three answers:
Mani S
2009-11-04 08:03:00 UTC
Hope this helps :)
Dan M
2009-11-04 08:09:25 UTC
anonymous
2016-10-17 02:20:42 UTC
ⓘ
This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.