Ayudenme por favor no se que hacer soy nuevo en esto,quiero hacerlo y terminarlo
Publicado por Joshua (4 intervenciones) el 07/05/2021 12:33:54
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
#include <iostream>
#include <conio.h>
#include <string.h>
#include <stdio.h>
#include <fstream>
#include <string>
#include <stdlib.h>
using namespace std;
struct caracteres {
int originales[50];
int cifrados[50];
};
void dictionary();
void encryptmess();
void deciphermess();
int opc, s,r;
int main() {
cout << "Bienvenido al encriptador" << endl;
cout << "--------------------------" << endl;
cout << "¿que desea hacer?" << endl;
cout << "1-Cargar diccionario" << endl;
cout << "2-Cifrar mensaje" << endl;
cout << "3-Descifrar mensaje" << endl;
cout << "4-Salir" << endl;
cin >> opc;
switch (opc) {
case 1: cout << "Cargar diccionario" << endl;
dictionary();
break;
case 2: cout << "Descifrar mensaje" << endl;
encryptmess();
break;
case 3: cout << "Cifrar mens" << endl;
deciphermess();
break;
case 4: cout << "Salir del programa" << endl;
if (opc = 4) {
cout << "seguro que quiere salir del programa?" << endl;
cout << "\n 1-si" << endl;
cout << "\n 2-no" << endl;
cin >> s;
if (s == 1)
{
return 0;
}
else
{
return main();
}
break;
default: cout << "no valido, intenta de nuevo" << endl;
return main();
break;
}
}
while (opc != 4);
system("pause");
return main();
}
void dictionary() {
cout << "Bienvenido al diccionario, aqui veras el significado de cada codigo" << endl;
}
void encryptmess() {
ofstream archivo;
string mensaje;
cout << "Bienvenido al cifrador o encriptador de mensajes" << endl;
cout << "el mensaje comenzara a encriptarse" << endl;
archivo.open("Cifrador.txt", ios::out);
if (archivo.fail()) {
cout << "No se abrio el archivo"<<endl;
exit(1);
}
cout << "por favor ingrese el mensaje a encriptar/cifrar" << endl;
getline(cin, mensaje);
cout << "el mensaje comenzara a encriptarse" << endl;
archivo << mensaje;
archivo.close();
return ;
}
void deciphermess() {
ofstream archive;
string mensajecod;
cout << "Bienvenido al descifrador de mensajes" << endl;
cout << "Por favor, ingrese el mensaje en codigos al que quiere descifrar" << endl;
archive.open("Descifrador.txt", ios::out);
if (archive.fail()) {
cout << "No se abrio el archivo" << endl;
exit(1);
}
getline(cin,mensajecod);
cout << "el mensaje comenzara a descifrarse" << endl;;
archive << mensajecod;
archive.close();
return ;
}
Valora esta pregunta


0