2024-06-13 15:02:39 +00:00
|
|
|
#include <string>
|
|
|
|
#include <iostream>
|
|
|
|
#include "caesar.hpp"
|
|
|
|
|
|
|
|
const std::string usage = "caesar <rotation> <text to encrypt>";
|
|
|
|
|
|
|
|
int main(int argc, char* argv[]) {
|
|
|
|
if(argc < 3) {
|
|
|
|
std::cout << usage << std::endl;
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
int rotation = std::stoi(argv[1]);
|
|
|
|
std::string toEncrypt = "";
|
|
|
|
|
|
|
|
for(int i = 2; i < argc; i++) {
|
|
|
|
toEncrypt += argv[i];
|
|
|
|
if(i < argc - 1) toEncrypt += " ";
|
|
|
|
}
|
|
|
|
|
|
|
|
Caesar caesar{rotation};
|
2024-06-13 16:37:44 +00:00
|
|
|
std::cout << toEncrypt << std::endl;
|
2024-06-13 15:02:39 +00:00
|
|
|
std::cout << caesar.encryptString(toEncrypt) << std::endl;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|