-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab2.cpp
More file actions
49 lines (42 loc) · 1.14 KB
/
Copy pathLab2.cpp
File metadata and controls
49 lines (42 loc) · 1.14 KB
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
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
#include <iostream>
#include <string>
using namespace std;
int main() {
string newstr;
string rnewstr;
string input;
cin>>input;
//char orgname = input;
//char newname[50] =
int inc;
cin>>inc;
//vector<string> list(length," ");
for(int i = 0; i<input.size(); i++)
{
if(input.at(i) != 'a' && input.at(i) != 'e' && input.at(i) != 'i' && input.at(i) != 'o' && input.at(i) != 'u')
{
if((input.at(i) + inc)>'z')
{
newstr += string(1,(input.at(i) + inc)- 26);
}
else
{
//strcat(newstr,string(1,(input.at(i) + inc)));
newstr += string(1,(input.at(i) + inc));
}
}
else
{
//strcat(newstr,string(1,(input.at(i))));
newstr += (string(1,input.at(i)));
}
}
//cout<<newstr<<endl;
for(int i = newstr.size()-1; i>=0; i--)
{
rnewstr += (string(1,newstr.at(i)));;
}
cout<<rnewstr;
return 0;
}
//input.at(i) != 'a' && input.at(i) != 'e' && input.at(i) != 'i' && input.at(i) != 'o' && input.at(i) != 'u'