utilities.cpp File Reference

Implementation file corresponding to utilities.h. More...

#include <cstdlib>
#include <cstring>
#include <ctime>
#include <fstream>
#include <iostream>
#include <iomanip>
#include <set>
#include <string>
#include <vector>
#include "utilities.h"

Namespaces

namespace  Scobey

Functions

void Scobey::ClearScreen (int numLines=25)
 Clears the screen (the default output stream, which is assumed by default to have 25 lines).
void Scobey::DisplayTextfile (const string &fileName, int numberOfLinesPerPause=23)
 Displays a file of text numberOfLinesPerPause lines at a time.
int Scobey::gcd (int a, int b)
 Finds the greatest common divisor of two nonnegative integers, at least one of which is strictly positive.
bool Scobey::isEven (int n)
 Determines if a positive integer is even.
bool Scobey::isOdd (int n)
 Determines if a positive integer is odd.
int Scobey::numberOfDigits (int n)
 Finds the number of digits in a positive integer.
void Scobey::Pause (int indentLevel=0, string message="", int pauseNumber=0)
 Causes the program to pause and wait for the user to press Enter to continue, with default values for the indentation level, the message supplying any additional information to the user, and the pause number.
void Scobey::ReadChar (const string &userPrompt, char &charValue)
 Gets a character (char) value from the user.
void Scobey::ReadDouble (const string &userPrompt, double &doubleValue)
 Gets a real (double) value from the user.
void Scobey::ReadInt (const string &userPrompt, int &intValue)
 Gets an integer (int) value from the user.
void Scobey::ReadNextLine (const string &userPrompt, string &lineValue)
 Reads the text entered by a user on the line following the prompt.
void Scobey::ReadThisLine (const string &userPrompt, string &lineValue)
 Reads the text entered by a user on the same line as the prompt.
void Scobey::ReadString (const string &userPrompt, string &stringValue)
 Gets a whitespace-delimited string value from the user.
bool Scobey::userSaysYes (const string &question)
 Gets the user's yes-or-no answer to a single question.


Detailed Description

Implementation file corresponding to utilities.h.

Author:
P. Scobey
Date:
Friday, July 25, 2008
Version:
2008.0
This file contains implementations of the following, in the given order:

The source code of this file is not available to the users of the Scobey namespace items provided by this utilities package. To make use of those facilities, a source code file must include utilities.h and link to utilities.obj (under Windows XP) or utilities.o (under Linux).

Todo:
  1. Validate the private random number generator in the RandomGenerator class.
  2. Add probability distributions.
  3. Add Screen class.
  4. Doxygen and related items and/or comments
    1. Ensure prompts and error messages are consistent.
    2. Check vertical spacing effects in doxygen comments.
    3. Check font size when printing (Menu class, for example).
    4. Check if warnings about std::whatever go away with latest version.
    5. Check utilities.h for using std::cout but not including the header that contains it (a doxygen problem).

Generated on Mon Sep 29 22:05:05 2008 for Utilities (from namespace Scobey) Package by  doxygen 1.5.5