Question: Please help with editing the following program to us C strings. (The language is C++). The assignment is the first picture, and the second picture

Please help with editing the following program to us C strings. (The language is C++). The assignment is the first picture, and the second picture is the program that needs edited. Thanks!

Please help with editing the following program to us C strings. (The

This is the lab #6 program that we're changing:

language is C++). The assignment is the first picture, and the secondpicture is the program that needs edited. Thanks! This is the lab

(3 pts) Static 1-d arrays: C-style Strings strings, instead of C++ st style string is a string of characters ended by the null character,' Since you don't know how big the message will be, you need to declare a character array large enough to hold a sentence, usually 256 characters will do! This means that the string can hold a maximum of 255 characters, plus one null character. char mssg[256]; Create another C-style string for your replace string too. Your getline) call needs to change to characters read from the user. Since you are using a C-style string now, you will need to use the cstring (or string.h) library, instead of string Notice, there are still functions for copying, searching, and finding the length of C strings, but assigning one string to another will not work anymore!!! Your function prototypes from lab #6 will change to use C strings, rather than C++ strings. Remember, C strings use character arrays, which are pointers. This means you do not need to pass by reference anymore. By default, the contents of an array can change inside a function, when you pass the name of the array as an argument to the function. You will need to change your function prototypes and definitions to character pointers or character arrays: void get_string(char *) void set_replace_string(char *, char*); int get_search_replace(char *, char *); OR void get_string(char D); void set_replace string(char ], char D); int get_search_replace(char [], char D); Now, re-write these functions to work with C strings, instead of C++strings. (3 pts) Static 1-d arrays: C-style Strings strings, instead of C++ st style string is a string of characters ended by the null character,' Since you don't know how big the message will be, you need to declare a character array large enough to hold a sentence, usually 256 characters will do! This means that the string can hold a maximum of 255 characters, plus one null character. char mssg[256]; Create another C-style string for your replace string too. Your getline) call needs to change to characters read from the user. Since you are using a C-style string now, you will need to use the cstring (or string.h) library, instead of string Notice, there are still functions for copying, searching, and finding the length of C strings, but assigning one string to another will not work anymore!!! Your function prototypes from lab #6 will change to use C strings, rather than C++ strings. Remember, C strings use character arrays, which are pointers. This means you do not need to pass by reference anymore. By default, the contents of an array can change inside a function, when you pass the name of the array as an argument to the function. You will need to change your function prototypes and definitions to character pointers or character arrays: void get_string(char *) void set_replace_string(char *, char*); int get_search_replace(char *, char *); OR void get_string(char D); void set_replace string(char ], char D); int get_search_replace(char [], char D); Now, re-write these functions to work with C strings, instead of C++strings

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!