Esempio n. 1
0
int problem1(){
    std::cout << "CensortString1 (pass by value):" << std::endl;
	std::cout << " Result of removing nt from Stanford University: " << CensorString1( "Stanford University", "nt" ) << "." << std::endl;

    std::cout << "CensortString2 (pass by reference):" << std::endl;
    string myText = "Stanford University";
    CensorString2( myText, "nt" );
    std::cout << " Result of removing nt from Stanford University: " << myText << std::endl << std::endl;
	
	
    std::cout << "CensortString1 (pass by value):" << std::endl;
	std::cout << " Result of removing la from Llamas like to laugh: " << CensorString1( "Llamas like to laugh", "la" ) << std::endl;

	std::cout <<  "CensortString2 (pass by reference):" << std::endl;
	myText = "Llamas like to laugh";
    CensorString2( myText, "la" );
    std::cout << " Result of removing la from Llamas like to laugh: " << myText << std::endl;
    
    return 0;}
int main() {
    //cout << "Enter a long string: ";
    //string text = GetLine();
    //cout << "Enter a shorter string with characters to remove: ";
    //string remove = GetLine();
    
    string text = "This is a very long sentence and will need to be truncated by a good smittly boo. Ugly as it, all the vowels will be lost.";
    string remove = "aeiou";
    
    string outString = CensorString1(text, remove);
    cout << "Text: " << text << endl;
    cout << "Censor: " << remove << endl;
    cout << "From 1: " << outString << endl;
    
    CensorString2(text, remove);
    cout << "From 2: " << text << endl;
    
    return 0;
    
}