mirror of
https://github.com/zs-yg/kortapp-z.git
synced 2025-12-06 16:10:42 +08:00
14 lines
334 B
C++
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;
|
|
}
|