The swap () function already exists in iostream. Therefore, it conflicts with your swap () function. You may need to specify which swap () you want to use or change the name of your swap function, e.g. swap1 (), swap2 (), etc. You can change any letter in UPPERCASE of your swap function, for example Swap () , this can solve the problem without deletingusing namespace std;
otherwise just delete using namespace std'and enter
using std :: cout;
using std :: endl;
instead of OR write code as -
std :: cout << "After swapping - a = " << a << ", b = " << b << std :: endl;
What is it. Thank.
source
share