#include using namespace std; // ====================================================== int augmente(int a, int b = 1) { return a + b; } // ====================================================== char augmente(char c) { // vérifier si c'est une MAJUSCULE if ((c >= 'a') and (c <= 'z')) { // si c'en est une, la transformer en minuscule : // une majuscule est à 'A' ce que sa minuscule est à 'a' : c = 'A' + (c - 'a'); } return c; } // ==== TESTS =========================================================== void test(char a) { cout << '\'' << a << "' --> '" << augmente(a) << '\'' << endl; } // ---------------------------------------------------------------------- void test(int a) { cout << a << " (tout seul) --> " << augmente(a) << endl; } // ---------------------------------------------------------------------- void test(int a, int b) { cout << a << " et " << b << " --> " << augmente(a, b) << endl; } // ---------------------------------------------------------------------- int main() { test(4, 5); test(4); test(0); test(1, 0); test('a'); test('i'); test('z'); test('A'); test(' '); test('?'); test('\n'); return 0; }