Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write at least two programs in two different programming languages of your choice to implement the following string functions that will perform the operations provided

image text in transcribed
Write at least two programs in two different programming languages of your choice to implement the following string functions that will perform the operations provided in most languages such as C++. Please note that you are to write operations on character arrays/lists or strings and not rely on any built-in string library or function such as string.h or STL. You must duplicate the operations of all five of the string functions in C++ snen ccapats atring or pointer o tring as an argument. Ruthelength of hestring (not nouding thetentoExample strcat: Accepts two C-strings or pointers to two strings as arguments, The function appends the contents of the second string to the first string. Usage: len strlen(name) The first string is altered, the second string is left unchanged.) Example Usage: strcat(string1, string2); stropy: Accepts two C-strings or pointers to two strings as arguments. The function copies the second string to the first string. The second string is left unchanged. Example Usage: strcpy(string1, string2); strncpy: Accepts two C-strings or pointers to two strings characters to copy from the second string to the first string. If the string2 has fewer than n characters, string1 is padded with '10' characters. Example Usage: strncpy/string1, string2, n); stremp: Accepts two C-strings or pointers to two string arguments.If string1 and string2are the same, this function returns O. If string2 is alphabetically greater than string1, it returns a negative number. If string2 is alphabetically less than string1, it returns a positive number. Example Usage: if (strcmp string1, string2) strstr: Accepts two C-strings or pointers to two C-strings as arguments, searches for the first occurrence of string2 in string1. If an occurrence of string2 is found, the function returns a pointer to it. Otherwise, it returns a NULL pointer (address 0). Example Usage: cout

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

More Books

Students also viewed these Databases questions