Question: C and C++ We are to implement our own versions of the following five utility functions without using any library functions. We are given some

C and C++

We are to implement our own versions of the following five utility functions without using any library functions. We are given some base code to start off. I am unsure on how to write the code without using any of the library functions, even with the base code to help. Thank you in advance for your help.

The five utility functions are: 1. myStrlen() - (20%) Implement your own version of strlen() and name it myStrlen(). 2. myStrcat() - (20%) Implement your own version of strcat() and name it myStrcat(). 3. myStrcpy() - (20%) Implement your own version of strcpy() and name it myStrcpy(). 4. myStrcat_BC() - (20%) Write a function named myStrcat_BC() so that it performs the functionality of strcat() with bounds checking. In case out of bound occurs, the function displays an error message on standard I/O screen. For example, the size of s1 is 11 and s1 = "World", if we use myStrcat() to concatenate itself to the end twice, its length should exceed 11 and function should prompt with "Out of bound!" message. 5. isPalindromic() - (20%) A palindromic word is a word which is the same no matter you read backward or forward. Some are examples are "I", "eye", and "madam." The case insensitive program treats upper case and lower case of a character the same. For example, R and r are the same, thus Radar is considered a palindromic word. In this function we want to do the case insensitive version. The function should be named isPalindromic(), which returns true if the word is palindromic. Otherwise, it returns false.

The base code is:

#include #include #include using namespace std; void myStrcpy(char [], char []); /// prototype example int main() { const int SIZE = 11; char s1[SIZE] = "Hello "; char s2[SIZE] = "World"; cout << "s1: " << " " << s1 << endl << endl; /// Should display "Hello " cout << "The length of s1: " << strlen(s1) << endl << endl; cout << "Doing strcat(s1, s2) " << endl; strcat(s1, s2); cout << "s1: " << " " << s1 << endl; /// Should display "Hello World" cout << "The length of s1: " << strlen(s1) << endl << endl; cout << "Doing strcpy(s1, s2) " << endl; strcpy(s1, s2); cout << "s2: " << " " << s1 << endl; /// Should display "World" cout << "The length of s1: " << strlen(s1) << endl << endl; /* Test myStrcat_BC() and isPalindromic() in the following ways: cout << "Doing myStrcat_BC(s1, s2, SIZE) " << endl; myStrcat_BC(s1, s2, SIZE); /// Should display "WorldWorld" cout << "s1: " << " " << s1 << endl; cout << "The length of s1: " << myStrlen(s1) << endl << endl; cout << "Doing myStrcat_BC(s1, s2, SIZE) again" << endl; myStrcat_BC(s1, s2, SIZE); /// Out of bound, prompt an error message cout << "s1: " << " " << s1 << endl; cout << "The length of s1: " << myStrlen(s1) << endl << endl; char s3[SIZE] = "World"; cout << "Doing isPalindromic(s3)" << endl; if (isPalindromic(s1)) cout << s1 << " is a palindromic word." << endl << endl; else cout << s1 << " is not a palindromic word." << endl << endl; char s4[SIZE] = "I"; cout << "Doing isPalindromic(s4)" << endl; if (isPalindromic(s4)) cout << s4 << " is a palindromic word." << endl << endl; else cout << s4 << " is not a palindromic word." << endl << endl; char s5[SIZE] = "Radar"; cout << "Doing isPalindromic(s5)" << endl; if (isPalindromic(s5)) cout << s5 << " is a palindromic word." << endl << endl; else cout << s5 << " is not a palindromic word." << endl << endl; char s6[SIZE] = "eye"; cout << "Doing isPalindromic(s6)" << endl; if (isPalindromic(s6)) cout << s6 << " is a palindromic word." << endl << endl; else cout << s6 << " is not a palindromic word." << endl << endl; */ return 0; }

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!