utils.cpp
// Nathan Eloe 4/11/2013
// utils.cpp
// Implementation of utility functions
#include "utils.h"
void formatMenu(const string menuOpts[], const unsigned int len)
{
cout << "---MENU---" << endl;
for (int i=0; i<len; i++)
cout << i+1 << ") " << menuOpts[i] << endl;
return;
}
int getBoundedInt(const int lbound, const int ubound)
{
int input;
do
{
cout << "Enter a value (" << lbound << "-" << ubound << "): ";
cin >> input;
if (input < lbound || input > ubound)
cout << "Number not in range. Try again." << endl;
} while (input < lbound || input > ubound);
return input;
}