-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.cpp
293 lines (276 loc) · 4.86 KB
/
main.cpp
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
#include <iostream>
#include <string>
using namespace std;
string morse(int clave){
string morse;
switch (clave)
{
case 65:
case 97:
morse = ".-";
break;
case 66:
case 98:
morse = "-...";
break;
case 67:
case 99:
morse = "-.-.";
break;
case 68:
case 100:
morse = "-..";
break;
case 69:
case 101:
morse = ".";
break;
case 70:
case 102:
morse = "..-.";
break;
case 71:
case 103:
morse = "--.";
break;
case 72:
case 104:
morse = "....";
break;
case 73:
case 105:
morse = "..";
break;
case 74:
case 106:
morse = ".---";
break;
case 75:
case 107:
morse = "-.-";
break;
case 76:
case 108:
morse = ".-..";
break;
case 77:
case 109:
morse = "--";
break;
case 78:
case 110:
morse = "-.";
break;
case 79:
case 111:
morse = "---";
break;
case 80:
case 112:
morse = ".--.";
break;
case 81:
case 113:
morse = "--.-";
break;
case 82:
case 114:
morse = ".-.";
break;
case 83:
case 115:
morse = "...";
break;
case 84:
case 116:
morse = "-";
break;
case 85:
case 117:
morse = "..-";
break;
case 86:
case 118:
morse = "...-";
break;
case 87:
case 119:
morse = ".--";
break;
case 88:
case 120:
morse = "-..-";
break;
case 89:
case 121:
morse = "-.--";
break;
case 90:
case 122:
morse = "--..";
break;
case 46:
morse = "●";
break;
case 48:
morse = "-----";
break;
case 49:
morse = ".----";
break;
case 50:
morse = "..---";
break;
case 51:
morse = "...--";
break;
case 52:
morse = "....-";
break;
case 53:
morse = ".....";
break;
case 54:
morse = "-....";
break;
case 55:
morse = "--...";
break;
case 56:
morse = "---..";
break;
case 57:
morse = "----.";
break;
default:
morse = clave;
break;
}
return morse;
};
string murcielago(int clave){ //arreglar de numero a letra
string murcielago;
switch (clave)
{
case 77:
case 109:
murcielago = "0";
break;
case 85:
case 117:
murcielago = "1";
break;
case 82:
case 114:
murcielago = "2";
break;
case 67:
case 99:
murcielago = "3";
break;
case 73:
case 105:
murcielago = "4";
break;
case 69:
case 101:
murcielago = "5";
break;
case 76:
case 108:
murcielago = "6";
break;
case 65:
case 97:
murcielago = "7";
break;
case 71:
case 103:
murcielago = "8";
break;
case 79:
case 111:
murcielago = "9";
break;
default:
murcielago = clave;
break;
}
return murcielago;
};
string cenitpolar(int clave){
string cenit;
switch (clave)
{
case 67:
case 99:
cenit = "p";
break;
case 69:
case 101:
cenit = "o";
break;
case 78:
case 110:
cenit = "l";
break;
case 73:
case 105:
cenit = "a";
break;
case 84:
case 116:
cenit = "r";
break;
case 80:
case 112:
cenit = "c";
break;
case 79:
case 111:
cenit = "e";
break;
case 76:
case 108:
cenit = "n";
break;
case 65:
case 97:
cenit = "i";
break;
case 82:
case 114:
cenit = "t";
break;
default:
cenit = clave;
break;
}
return cenit;
};
void traducir(string& arreglo, int length, string (*func)(int)) {
int ascii;
string aux;
for (int cont = 0; cont < length; ++cont) {
ascii = static_cast<int>(arreglo[cont]);
aux = func(ascii);
if (!aux.empty()) {
arreglo[cont] = aux[0];
}
}
}
void traducir_murcielago(string& arreglo, int length){
}
int main() {
string clave;
cout << "Ingrese una palabra a encriptar: " << endl;
getline(cin, clave);
cout << "Arreglo original: " << clave << endl;
traducir(clave, clave.length(), cenitpolar);
cout << "Cenitpolar: " << clave << endl;
traducir(clave, clave.length(), murcielago);
cout << "Murciélago: " << clave << endl;
traducir(clave, clave.length(), morse);
cout << "Morse: " << clave << endl;
return 0;
}