Skip to content

Instantly share code, notes, and snippets.

@shipof123
Created April 30, 2020 20:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shipof123/41cf12106269dfed238cce83549a163e to your computer and use it in GitHub Desktop.
Save shipof123/41cf12106269dfed238cce83549a163e to your computer and use it in GitHub Desktop.
#include <algorithm>
#include <iostream>
#include <string>
#include <fstream>
#include <cctype>
#include <array>
#include <set>
void fixText(std::string& s) {
std::transform(s.begin(), s.end(), s.begin(),
[](unsigned char c){ return std::tolower(c); });
std::replace(s.begin(), s.end(), 'j', 'i');
s.erase(std::remove_if(s.begin(), s.end(), std::isalpha), s.end());
}
std::array<std::array<int, 5>, 5> ploybius(std::string key) {
std::set<char> chars;
key.erase(std::remove_if(key.begin(), key.end(),[&chars](char c){
if(char.count(i)) {return true;}
chars.insert(i);
return false;
}), key.end());
std::string alpha = "abcdefghiklmnopqrstuvwxyz";
for (size_t i = 0; i < key.length(); i++) {
}
}
std::string encode() {
}
void inline encode_setup() {
std::string key1, key2, plaintext;
std::cout << "Input key";
std::cin >> key1;
std::cout << "Input keyword";
std::cin >> key2;
std::cout << "Input text to encode: ";
std::cin >> plaintext;
fixText(key1);
fixText(key2);
fixText(plaintext);
std::cout << encode(key1, key2, plaintext) << std::endl;
}
void decode_setup() {
}
int main(int argc, char** argv) {
if(argc < 0) {
char choice;
choice:
std::cout << "(E)ncode or (D)ecode?:";
std::cin >> choice;
switch (choice) {
case 'E':
case 'e':
encode_setup();
break;
case 'D':
case 'd':
break;
default:
goto choice;
}
} else {
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment