Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <110ct.h>
- using namespace std;
- void swapper (int arr1[], int arr2[]);
- int reverser (int arr2[], int i, int j);
- ColourController cl;
- int pos, i, j;
- int main ()
- {
- int arr1[10] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
- int arr2[10] = {1, 7, 9, 21, 84, 104, 56, 32, 91, 62};
- cl.setForeground (Yellow);
- cout << "Reversing the Elements in an Array: \n\n";
- for (int i = 0; i < 10; ++i)
- {
- cl.setForeground (White);
- cout << arr2[i] << " ";
- }
- cout << endl;
- cl.setForeground (Green);
- cout << "Please hit the enter key to reverse the elements seen in the array. \n";
- cout << endl;
- swapper (arr1, arr2);
- qin.get();
- cl.setForeground (Red);
- cout << endl << endl;
- cout << "Thank you for using the array reverser. \n";
- cin.ignore (2);
- return 0;
- }
- void swapper (int arr1[], int arr2[])
- {
- int j = 9;
- for (int i = 0; i < 10; ++i, --j)
- {
- arr1[j] = arr2[i];
- }
- for (int i = 0; i < 10; ++i)
- {
- arr2[i] = arr1[i];
- }
- qin.get();
- for (int i = 0; i < 10; ++i)
- {
- cl.setForeground (Aqua);
- cout << arr2[i] << " ";
- }
- }
Add Comment
Please, Sign In to add comment