Answers for "swap function in c++ library"

C++
7

what library to mention for swap function in c++

#include<bits/stdc++.h>
Posted by: Guest on June-17-2020
3

C++ Swap Function

int a, b;

    cout << "Input first number: ";
    cin >> a;
    cout << "Input second number: ";
    cin >> b;

    swap (a, b);

    cout << "After swapping the first number: " << a << endl;
    cout << "After swapping the second number: " << b << endl;
Posted by: Guest on March-13-2022

Browse Popular Code Answers by Language