Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ConsoleApplication3.cpp : Defines the entry point for the console application.
- //
- #include "stdafx.h"
- #include<iostream>
- #include<string>
- #include<fstream>
- using namespace std;
- int main()
- {
- int i;
- int c=0;
- string p= "Congratulations Mrs. <name>, you and Mr. <name> are the lucky recipients of a trip to XXXXXX. Your trip to XXX is already scheduled.";
- int pos = p.find("<name>",0);
- p.replace(pos, 6, "Smith");
- pos = p.find("<name>", 0);
- p.replace(pos, 6, "Smith");
- int pos2 = p.find("X", 0);
- for (i = pos2; p[i]=='X'; i++){
- c++;
- }
- cout << c;
- p.erase(pos2, c);
- p.insert(pos2, "Siberia");
- /////
- pos2 = p.find("X", 0);
- for (i = pos2; p[i] == 'X'; i++){
- c++;
- }
- cout << c;
- p.erase(pos2, c);
- p.insert(pos2, "Siberia");
- cout << p;
- system("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement