#include <iostream>
#include <algorithm>
#include <iomanip>
using namespace std;
// Function prototypes
void DisplayA(int[], int);
void showArray(int[], int);
void DisplayB(string[], int);
void showArrayDays(string[], int);
int main()
{
int a[5] = { 10, 4, 9, 55, 11 };
string Days[7] = { "Mon", "Tue", "Wed", "Thr", "Fri", "Sat", "Sun" };
char Vowels[5] = { 'U', 'O', 'I', 'E', 'A' };
cout << "Original array\n";
cout << "a: ";
showArray(a, 5);
cout << "Days: ";
showArrayDays(Days, 7);
// Sort the array
DisplayA(a, 5);
// Display the values again
cout << "After being sorted\n";
cout << "a: ";
showArray(a, 5);
system("pause");
return 0;
}
void DisplayA(int array[], int size)
{
int i, minIndex, minValue;
for (i = 0; i < (size - 1); i++)
{
minIndex = i;
minValue = array[i];
for (int index = i + 1; index < size; index++)
{
if (array[index] < minValue)
{
minValue = array[index];
minIndex = index;
}
}
array[minIndex] = array[i];
array[i] = minValue;
}
}
void showArray(int array[], int size)
{
for (int count = 0; count < size; count++)
cout << array[count] << " ";
cout << endl;
}