/* Nome: Mario Cognome: Montanari Classe: 3AIN Data: 08/03/2025 */ #include #include #define SIZE 100+1 using namespace std; void encryptCaesarCipher(char *str); int main(void) { char str[SIZE]; //ABCDEFGHIJKLMNOPQRSTUVWXYZ cout << "Inserisci una frase: "; cin.getline(str, SIZE); encryptCaesarCipher(str); return 0; } void encryptCaesarCipher(char *str) { for (int i = 0; str[i] != '\0'; i++) { if (isalpha(str[i])) { if (isupper(str[i])) { str[i] = ((str[i] - 'A' + 3) % 26) + 'A'; } else if (islower(str[i])) { str[i] = ((str[i] - 'a' + 3) % 26) + 'a'; } } } cout << "Frase codificata: " << str << endl; }