Write a C++ program 1. Study the function process_text() in file \"text_processing.cpp\". What do the string member functions find(), substr(), c_str() do? //text_processing.cpp #include \"util.h\" #include \"text_processing.h\" #include using namespace std; int process_text( fstream &ifs, fstream &ofs, char target[] ) { string replace_str( \"XXX\" ); //hard-coded string for replacement int tlen = strlen( target ); //string length of target int max_len = 200; //maximum length of a line char s[max_len+1]; clear_screen(); //clear the screen while ( !ifs.eof() ) { int i2, i1 = 0, len=0; ifs.getline( s, max_len ); //get one line from file string str( s ); //construct a string object i2 = str.find ( target, i1 ); //find target len = i2 - i1; if ( i2 > -1 && len > 0 ){ //if target found print_text( str.substr( i1, i2 ).c_str() ); //print up to target ofs << str.substr( i1, i2 ); } while ( i2 > -1 ) { print_text_inverse ( target ); //highlight target ofs << replace_str; i1 = i2 + tlen; //new search position i2 = str.find ( target, i1 ); //find next target len = i2 - i1; if ( i2 > -1 && len > 0 ){ //found target print_text( str.substr( i1, len ).c_str() ); //print up to target ofs << str.substr( i1, len ); } } len = str.length() - i1; if ( len > 0 ) { //print the remainder print_text( str.substr( i1, len ).c_str() ); ofs << str.substr( i1, len ); } ofs << endl; getnstr( s, 1 ); //prompt for } //while ( !ifs.eof() ) restore_screen(); //restore the old screen return 1; } //text_processing.h #ifndef TEXT_PROCESSING_H #define TEXT_PROCESSING_H #include #include using namespace std; int process_text( fstream &ifs, fstream &ofs, char target[] ); #endif //util.h #ifndef UTIL_H #define UTIL_H #include #include #include #include #include using namespace std; void usage ( char program_name[] ); void clear_screen(); void print_text( const char *s ); void print_text_inverse( const char *s ); void get_input_text( char *s, int max_len ); void restore_screen(); #endif //util.cpp #include \"util.h\" void usage ( char program_name[] ) { cout << \"Usage: \" << program_name << \" infile outfile search_string\" << endl; return; } /* The following are some curses functions. You can find the details by the command \"man ncurses\". But its use can be transparent to you. */ void clear_screen() { initscr(); scrollok ( stdscr, true ); //allow window to scroll } void print_text ( const char *s ) { printw(\"%s\", s ); refresh(); } void print_text_inverse( const char *s ) { attron( A_REVERSE ); printw(\"%s\", s ); attroff( A_REVERSE ); refresh(); } void get_input_text( char *s, int max_len ) { getnstr( s, max_len ); } void restore_screen() { endwin(); } //str_main.cpp #include \"util.h\" #include \"text_processing.h\" #include using namespace std; /* Note that grace_open() must be defined in same file as main(), otherwise the destructor of fstream will automatically close the opened file as it finds that its out of scope upon exiting the function. */ int grace_open( char *s, fst.