Language: C++ Write a program swapref.cpp, which provides three overloaded functions void swapping (...). These functions should swap two integers, two floats, and two pointers to char. The swapping...


Please write with simple codes


Language: C++<br>Write a program swapref.cpp, which provides three overloaded functions void swapping (...).<br>These functions should swap two integers, two floats, and two pointers to char. The swapping<br>should be done by a “real
using namespace std; void swapping(...) void swapping(...) void swapping(...) } // swap ints } // swap floats } // swap char pointers { { int main(void) { int a = 7, b = 15; float x = 3.5, y = 9.2; const char *str1 = "One"; const char * str2 = "Two"; cout < "a=" << a << " ,="" b=" << b << endl; cout << " x=" << x << " ,="" y=" << y << endl; cout << " str1=" << strl << " ,="" str2=" << str2 << endl; swapping (a, b); swapping (x, y); swapping (strl, str2); cout << " a=" << a << " b=" << b << endl; cout << " x=" << x << " ,="" y=" << y << endl; cout << " str1=" << str1 << " ,="" str2=" << str2 << endl; return 0; } ">
Extracted text: Language: C++ Write a program swapref.cpp, which provides three overloaded functions void swapping (...). These functions should swap two integers, two floats, and two pointers to char. The swapping should be done by a “real" call-by-reference (i.e., not by using *). Complete the following code fragment: #include using namespace std; void swapping(...) void swapping(...) void swapping(...) } // swap ints } // swap floats } // swap char pointers { { int main(void) { int a = 7, b = 15; float x = 3.5, y = 9.2; const char *str1 = "One"; const char * str2 = "Two"; cout < "a=" << a << ", b=" << b << endl; cout << "x=" << x << ", y=" << y << endl; cout << "str1=" << strl << ", str2=" << str2 << endl; swapping (a, b); swapping (x, y); swapping (strl, str2); cout << "a=" << a << " b=" << b << endl; cout << "x=" << x << ", y=" << y << endl; cout << "str1=" << str1 << ", str2=" << str2 << endl; return 0; }

"a=" << a << " ,="" b=" << b << endl; cout << " x=" << x << " ,="" y=" << y << endl; cout << " str1=" << strl << " ,="" str2=" << str2 << endl; swapping (a, b); swapping (x, y); swapping (strl, str2); cout << " a=" << a << " b=" << b << endl; cout << " x=" << x << " ,="" y=" << y << endl; cout << " str1=" << str1 << " ,="" str2="">
>
Jun 05, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here