Download the starter code main.cpp, hw6.h, and hw6.cpp. You will only turn in hw
ID: 3840145 • Letter: D
Question
Download the starter code main.cpp, hw6.h, and hw6.cpp. You will only turn in hw6.cpp. Do not modify hw6.h, as you have no reason to We have provided main.cpp to give you an idea of how we intend to use the functions. You are free to do whatever you want with main.cpp (and you'll want to make changes to it for debugging) but you won't submit it. hw6.cpp must not contain a main function. You may not use global variables. We may take off up to 20% of the total marks for poor style; make sure to name your variables reasonably, indent properly, and comment sufficiently. Submit hw6.cpp.
Explanation / Answer
Please find my implementation.
char* my_strcpy(char* destination, const char* source) {
int i;
i = 0;
while(source[i])
{
destination[i] = source[i];
i = i + 1;
}
destination[i] = '';
return destination;
}
int my_strcmp(const char* str1, const char* str2) {
int i;
i = 0;
while (str1[i] == str2[i] && str1[i])
i++;
return (str1[i] - str2[i]);
}
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.