Assignment: #cstrings Due: 10/30/2017 Points: 4


Write a C++ program that implements the following STDC Library string.h functions.

   size_t strlen(const char *__s);
   int    strcmp(const char *__s1, const char *__s2);
   char*  strcpy(char *__s1, const char *__s2);
   char*  strcat(char *__s1, const char *__s2);

The size_t strlen(const char* __s) function returns the length of _s. Note: The length of a string excludes the terminating NULL character.

The int strcmp(const char* __s1, const char* __s2) function returns 0 if __s1 equals __s2; -1 if __s1 is lexicographically less than __s2; +1 if the __s2 is lexicographically greater than __s1. Note: In the case of inequality, our return values of our strcmp() function differ from those in the STDC Library.

The char* strcpy(char* __s1, const char* __s2) function copies __s2 into __s1. The copy includes the NULL terminating character (i.e. __s1 must be NULL terminated). The function returns __s1.

The strcat(char *__s1, const char *__s2) functions concatenates the contents of __s2 onto __s1 beginning with the NULL character of __s1. Note: The concatenation includes the NULL character of __s2. The function returns __s1.

At minimum the main() function should prompt the user to enter two strings that are used as arguments to the string functions.