Substitute an alphabetical char with another

I have to modify a string by replacing the alphabetical letter by a given integer of letters. For example, abcde with mod_int (modifying integer) 1 would be bcdef. I'm confusing myself because I'm using letters instead of numbers, please help or maybe give some guidance of what my next step should be. My for statement isn't if insisted, but that is my attempt at making it loop back over when it gets to 26. If you could input some advice I would really appreciate it :)

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
  #include <iostream>
#include <string>
 
#include "ctype.h"
using namespace std;
string ModifyString (string input_string, int mod_int)
int main();
{
int mod_int, recover_int;
string input_string, mod_string, recovered_string;

while (1) {
cout << "Please Enter a Modifying Integer (Or -1 to Exit)" << endl;
cin >> mod_int
if (mod_int == -1) break;
for (mod_int=0; mod_int<=26; mod_int++)

string input_string = input_string + mod_string
cout << "Please Enter a Word to be Modified" << endl;
cin >> input_string;

mod_string = ModifyString(input_string, mod_int);
cout << "The Modified Word is " << mod_string << endl;

recover_int = 26 - (mod_int%26);
recovered_string = ModifyString(mod_string, recovered_int);
cout << "The Recovered Word is " << recovered_string << endl;
}
return input_string;
}
Topic archived. No new replies allowed.