Files
kortapp-z/others/C++/text converter/src/ROT13Converter.cpp
2025-07-07 16:52:56 +08:00

14 lines
334 B
C++

#include "../include/ROT13Converter.hpp"
std::string ROT13Converter::convert(const std::string& input) {
std::string result;
for (char c : input) {
if (isalpha(c)) {
char base = isupper(c) ? 'A' : 'a';
c = (c - base + 13) % 26 + base;
}
result += c;
}
return result;
}