Make your own free website on Tripod.com
« December 2018 »
S M T W T F S
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31
You are not logged in. Log in
Entries by Topic
All topics  «
Blog Tools
Edit your Blog
Build a Blog
RSS Feed
View Profile
Substring Scores Assignment
Sunday, 3 February 2008
Chapter 10 PC 10

#include <iostream>
#include <string>
using namespace std;

void replaceSubstring(string, string, string);

int main(){
    string string1, string2, string3;
    cout <<"Substring Program!\n\n\n";
    cout << "Please enter string one: \n";
    getline (cin, string1);
    cout << "Please enter string two: \n";
    getline (cin, string2);
    cout << "Please enter string three: \n";
    getline (cin, string3);
    replaceSubstring(string1, string2, string3);
    system ("pause");
    return 0;
}
void replaceSubstring(string string1, string string2, string string3){
     int start = string1.find(string2);
     string1.replace(start,string2.size(),string3);
     cout << string1 << endl;
}

 


Posted by veronicak5678 at 8:09 PM EST

Newer | Latest | Older