C++ Library Assignments
Write a C++ program that duplicates the functionality that strlen, strcmp and strcpy perform. The catch is not to use these builtin functions but to walk through the arrays character by character.
Strlen = calculates the length of a given string
Strcmp = compares two strings and will print out true if they are equal. For this you will use the equality “==” logical operator.
Strcpy = copies one string into a new string. For this you will need two arrays of the same size.
You will need to write three loops to solve this problem. The input could either be input from the keyboard or hard-coded into your program. By hard-coded I mean declared in main. For example
strlen
void main()
{
myString = “abcde”;
//figure out the length of the string in a loop
}
Extra Credit
Break your code into three separate functions that are called from main().
Call the functions stringLength(), stringCompare() and stringCopy()