//------------------------------------------------------------------ // // More examples of string handling // // Simon Parsons // April 30th 2007 // //------------------------------------------------------------------ // Include C++ library definitions #include // For input and output #include // To handle strings using namespace std; //------------------------------------------------------------------ // // Function prototypes void noChange(string); void change(string &); //------------------------------------------------------------------ // // The main method int main() { // Variable definitions string dna = "ggtataccggaa"; // First call the function with a regular parameter cout << "Before calling noChange" << endl; cout << dna << endl; noChange(dna); cout << "After calling noChange" << endl; cout << dna << endl; // NOw call the function with a reference parameter cout << "Before calling change" << endl; cout << dna << endl; change(dna); cout << "After calling change" << endl; cout << dna << endl; return 0; } //------------------------------------------------------------------ // // Function definitions // The function that does not use a reference parameter void noChange(string s) { cout << "Replace tata with gaga in noChnage" << endl; s.replace(s.find("tata"), 4, "gaga"); cout << s <