C++ has a built in swap functionby qbguy (no login)// swap algorithm example #include <iostream> #include <algorithm> using namespace std; typedef struct newtypet { double a, b; } newtypet; newtypet old, neww; int main () { old.a = 10; old.b = 20; neww.a = 1; neww.b = 2; cout << old.a << endl; cout << old.b << endl; cout << neww.a << endl; cout << neww.b << endl; swap(old, neww); cout << endl; cout << old.a << endl; cout << old.b << endl; cout << neww.a << endl; cout << neww.b << endl; return 0; } from IP address 75.0.227.216 |
| Response Title | Author and Date |
| Would be a lot easier to make in Qbasic........... | on Jun 27 |
| The compiler translates to C++ which is why i mentioned C++'s swap function | qbguy on Jun 28 |