#include "caesar.hpp" #include Caesar::Caesar(int rotation) { setRotation(rotation); } void Caesar::setRotation(int rotation) { this->rotation = rotation; } int Caesar::getRotation() { return rotation; } char Caesar::encryptChar(char toEncrypt) { char newChar = toEncrypt + rotation; if(newChar > MAX) newChar -= MAX; if(newChar < MIN) newChar += MIN; return newChar; } std::string Caesar::encryptString(std::string toEncrypt) { std::string encrypted = ""; for(int i = 0; i < toEncrypt.length(); i++) { encrypted += encryptChar(toEncrypt[i]); } return encrypted; }