move letter position using c++ with input

#include <iostream>
#include <string>

int main() {
    std::string inputString;
    int moveBy;

    // Input
    std::cout << "Enter a string: ";
    std::getline(std::cin, inputString);

    std::cout << "Enter the number of positions to move: ";
    std::cin >> moveBy;

    // Move letter positions
    for (char &ch : inputString) {
        if (std::isalpha(ch)) {
            char base = (std::isupper(ch)) ? 'A' : 'a';
            ch = static_cast<char>((ch - base + moveBy) % 26 + base);
        }
    }

    // Output
    std::cout << "Result: " << inputString << std::endl;

    return 0;
}