Here it is, just swaps around elements of an array and then outputs it. Nothing special, had to do it for school so I thought I would release it
Thank you.
Code:
#include <iostream>
using namespace std;
void swapNames(string names[])
{
swap(names[0], names[2]);
swap(names[1], names[4]);
}
int main()
{
string names[5] = {"Peter", "Brian", "Matthew", "Kevin", "Jackson"};
cout << "Before sorting: ";
for (int x = 0; x < 5; x++)
cout << names[x] << " ";
swapNames(names);
cout << "\nAfter sorting: ";
for (int i = 0; i < 5; i++)
cout << names[i] << " ";
cin.get();
return 0;
}
Thank you.