Question: You will write 2 functions: int cstrcat(char dst[], char src[]) which concatenates the char array src[] to char array dst[], and returns the new length

You will write 2 functions:

int cstrcat(char dst[], char src[]) which concatenates the char array src[] to char array dst[], and returns the new length of the dst[], not counting the null terminator character. You may assume dst[] was declared large enough to handle the combined length. Write the loop to do the copy, do NOT make calls to C-string library functions.

bool cstrcmp(char s[], char t[]) which compares the char array s[] to char array t[], and returns true if the strings are identical. Write the loop to do the compare, do NOT make calls to C-string library functions. Be sure you don't compare past the end of either string.

Your main() program should:

(1) Prompt the user to enter 2 strings, and save into 2 char[80] arrays using cin.getline(). Assume the user will enter less than 30 characters for each string.(1 pt) Ex:

Enter 2 strings: Hello, world! Hello there. 

(2) Use the cstrcmp() function to determine if they are equal, and print out a statement (1pt): Ex:

The strings are NOT equal. 

(3) Call the cstrcat() function to append the 2nd string to the first, then print out the new longer string and its length (1 pt): Ex:

Concatenated string: Hello, world!Hello there. Length: 25 

This is C++ Pease check for using Visual studio

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!