Assignment: #cstrings Due: 10/14/02018 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 __s1 is lexicographically greater than __s2. 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.

The main() function should prompt the user to enter two strings that are used as arguments to the string functions. The strings should be read into char[] arrays.

The output of the program is the output you used to test your program.