ralphsortfncts.cpp
//Name: Eric Barnes
//Quest: To seek the holy grail
//Favorite color: blue ...NO RED!
//Description: Function definitions for ralphs sorting algorithm
#include "ralphsort.h"
using namespace std;
void init_array(char arr[], const int size)
{
for(int i = 0; i < size; i++)
{
arr[i] = rand() % LETTERS_RANGE + LETTERS_MIN;
}
return;
}
void init_array(wookie arr[], const int size)
{
for(int i = 0; i < size; i++)
{
cout << "Name a wookie: ";
cin >> arr[i].name;
arr[i].weight = rand() % WEIGHT_RANGE + WEIGHT_MIN;
arr[i].height = rand() % HEIGHT_RANGE + HEIGHT_MIN;
}
return;
}
bool operator > (const wookie w1, const wookie w2)
{
return(w1.weight+ w1.height > w2.weight + w2.height);
}
ostream & operator << (ostream & os, const wookie wook)
{
os << wook.name << " weighing in at " << wook.weight
<< " with a height of " << wook.height
<< "(total " << wook.weight + wook.height << ")";
return os;
}