#include #include "swap.h" using namespace std; int main(){ char f; cout << "Choisissez une fonction swap: d - defaut, p - pointeur, r - reference : "; cin >> f; cout << endl; if(f != 'd' && f != 'p' && f != 'r') { return 1; } int a = 10; int b = 20; switch(f) { case('d'): cout << "avant swap: " << a << " " << b << endl; swap(a, b); cout << "apres swap: " << a << " " << b << endl << endl; break; case('p'): cout << "avant swap_p: " << a << " " << b << endl; swap_p(&a, &b); cout << "apres swap_r: " << a << " " << b << endl << endl; break; case('r'): cout << "avant swap_ref: " << a << " " << b << endl; swap_ref(a, b); cout << "apres swap_ref: " << a << " " << b << endl << endl; break; } return 0; }