C++
#include
using namespace std;
char getNextCharacter(char ch, int N) {
int alphabetSize = 26; // Số lượng chữ cái trong bảng chữ cái tiếng Anh
int offset = N % alphabetSize; // Số bước dịch chữ cái
// Chuyển chữ cái về mã ASCII và thực hiện phép dịch
int asciiValue = static_cast(ch);
int shiftedAsciiValue = (asciiValue - 'a' + offset) % alphabetSize;
// Chuyển lại thành chữ cái
char nextCharacter = static_cast(shiftedAsciiValue + 'a');
return nextCharacter;
}
int main() {
char ch;
int N;
cout << "Enter a lowercase letter: ";
cin >> ch;
cout << "Enter the number of steps N: ";
cin >> N;
char nextCharacter = getNextCharacter(ch, N);
cout << "Next character: " << nextCharacter << endl;
return 0;
}