// Conversione di un carattere da minuscolo a maiuscolo o viceversa. #include using namespace std; #define SCARTO 32 int main() { cout << endl << "*** CONVERSIONE MINUSCOLO <---> MAIUSCOLO ***" << endl << endl; char c; cout << "Inserisci un carattere: " << endl; cin >> c; // E' equivalente fare `if (c >= 'a' && c <= 'z')'. if (c >= 97 && c <= 122) { char c_conv = c - SCARTO; cout << c << " -> " << c_conv << endl; } else if (c >= 65 && c <= 90) { char c_conv = c + SCARTO; cout << c << " -> " << c_conv << endl; } else cout << "Carattere non convertibile." << endl; cout << "Premi un tasto seguito da invio per uscire" << endl; cin >> c; return 0; }