Question: This is week 7 lab code: #include #include using namespace std; // Function prototypes void get_string(string *); void set_replace_string(string, string *); int get_search_replace(char, string, string


This is week 7 lab code:
#include #include using namespace std;
// Function prototypes void get_string(string *); void set_replace_string(string, string *); int get_search_replace(char, string, string &);
// Main function int main(){
string str, c_str; char letter; get_string(&str); set_replace_string(str, &c_str); cout > letter; get_search_replace(letter, str, c_str); cout
// This function takes a string void get_string(string *s){ cout
// This function sets all non-space letters to dashes void set_replace_string(string o_str, string *n_str){ *n_str = ""; for(int i=0; i // This function takes a letter from the user then replace the dash witht he letter int get_search_replace(char c, string o_str, string &n_str){ int count = 0; for(int i=0; i } return count; }
(5 pts) Static 1-d arrays: C-style Strings First, go back and review the assignment from Lab 7 Next, change your implementation from Lab 7 to use C-style strings, instead of C++ strings. A C-style string is a string of characters ended by the null character, 10. 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 message[256]; Create another C-style string for your replacement string too. Your getline) call needs to change to cin.getline), and this function will automatically insert a null character at the end of the 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 //www.cplusplus.com/reference/cstringl?kw-cstri 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 #7 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 ); Now, re-write these functions to work with C-style strings, instead of C++ strings