Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include "stdafx.h"
- #include <ctime>
- #include <iostream>
- using namespace std;
- int main()
- {
- char answer;
- do{
- srand(time(NULL));
- const int str = 40;
- char* string = new char[str];
- cout << "Type string: ";
- cin.getline(string, str+1);
- /*for (int i = 0; i < str; ++i)
- {
- string[i] = rand() / 64 % 123;
- cout << string[i];
- }*/
- for (int j = 0; j < str; ++j)
- {
- if (string[j] == 'a' && string[j + 1] == 'b' && string[j + 2] == 'c')
- {
- string[j] = 'd';
- string[j + 1] = 'e';
- string[j + 2] = 'f';
- }
- cout << string[j];
- }
- cout << "\nTry again? y/n\n";
- cin >> answer;
- } while (answer != 'n');
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement