Caesar/main.cpp

26 lines
495 B
C++
Raw Normal View History

#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};
std::cout << caesar.encryptString(toEncrypt) << std::endl;
return 0;
}