#include <iostream> 
#include <string> 
using namespace std; 
  
int main() 
{ 
  // create an array with the days of the week 
  const int SIZE = 7; 
  string day[] = {"Monday", "Tuesday", "Wednesday", 
    "Thursday", "Friday", "Saturday", "Sunday"}; 
  
  // output contents of the array, in original order
  cout << "Unsorted: "; 
  int i; // reused in 3 following for-loops 
  for (i = 0; i < SIZE; i++) 
    cout << day[i] << ' '; 
  cout << endl; 
  
  // 2 nested for-loops to sort the array
  for (i = 0; i < SIZE; i++) 
  {
    for (int j = i + 1; j < SIZE; j++) 
    { 
      if (day[i] > day[j]) 
      { 
        // swap code 
        string temp = day[i]; 
        day[i] = day[j];   
        day[j] = temp; 
      } // if 
    } // for 
  } // for 
  
  // output contents, in alphabetical order
  cout << "Sorted: "; 
  for (i = 0; i < SIZE; i++) 
    cout << day[i] << ' '; 
  cout << endl; 
} // main 
