Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <bits/stdc++.h>
- using namespace std;
- char palabra[100];
- char clave[100];
- int numeros1[100];
- int numeros2[100];
- int main(){
- // Una herramienta hecha por Best Titan
- //Sitio Oficial: bt4games.blogspot.com
- std::cin.tie(nullptr);
- std::ios_base::sync_with_stdio(false);
- cout << endl << endl;
- cout << "::: ::: :::::::: ::: :::::::: :::::::: ::: :::" << endl;
- cout << ":+: :+: :+: :+: :+: :+: :+: :+: :+: :+: :+: " << endl;
- cout << "+:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ +:+ " << endl;
- cout << "+#+ +:+ :#: +#+ +#+ +:+ +#+ +#++:++ " << endl;
- cout << " +#+ +#+ +#+ +#+# +#+ +#+ +#+ +#+ +#+ +#+ " << endl;
- cout << " #+#+#+# #+# #+# #+# #+# #+# #+# #+# #+# #+# " << endl;
- cout << " ### ######## ########## ######## ######## ### ###" << endl;
- cout << endl << endl;
- cout << " [Escribe 1 para cifrar] [Escribe 2 para descifrar]" << endl;
- int m = 0;
- cin >> m;
- cout << endl << "Escribe el texto a " << (m == 1 ? "cifrar " : "descifrar ") << "usando solo MAYUSCULAS (sin espacios)" << endl;
- cin >> palabra;
- cout << endl << "Escribe la contrasena para " << (m == 1 ? "cifrar " : "descifrar ") << " el texto usando solo MAYUSCULAS (sin espacios)" << endl;
- cin >> clave;
- cout << endl << "El texto " << (m == 1 ? "cifrado " : "descifrado ") << "es:" << endl;
- int x = 0;
- int y = 0;
- int aux = 0;
- for(int i = 0; i<100; i++){
- numeros1[i] = palabra[i]-64;
- numeros2[i] = clave[i]-64;
- if(numeros2[i] == -64 && y == 0) y = i;
- if(numeros2[i] == -64){
- if(aux == y) aux = 0;
- numeros2[i] = clave[aux]-64;
- aux++;
- }
- if(numeros1[i] == -64){
- x = i;
- break;
- }
- }
- if(m == 1){
- int suma = 0;
- char caracter = 0;
- for(int i = 0; i<x; i++){
- suma = numeros1[i] + numeros2[i] -1;
- if(suma > 26) suma -= 26;
- caracter = suma+64;
- cout << caracter;
- }
- }
- if(m == 2){
- int suma = 0;
- char caracter = 0;
- for(int i = 0; i<x; i++){
- suma = numeros1[i] - numeros2[i] +1;
- if(suma<=0) suma += 26;
- caracter = abs(suma)+64;
- cout << caracter;
- }
- }
- cout << endl << endl << endl << "Para cifrar o descifrar otro texto cierra y vuelve a abrir el programa";
- cout << endl << endl << "Una herramienta hecha por Best Titan" << endl << "Sitio Oficial: bt4games.blogspot.com"<< endl;
- cin >> m;
- }
Advertisement
Add Comment
Please, Sign In to add comment