Utilities Package  Version VS2013.0
 All Classes Namespaces Files Functions Variables Typedefs Pages
Utilities Package Documentation

This is the Fall, 2014 version of the documentation for the instructor-supplied C++ utilities package to be used in CSCI 2341 and CSCI 2342. You will find here descriptions of some very useful (time-saving) constant definitions, free functions, and classes. It will take some time to become thoroughly familiar with all that is available, but you will need to start using the package near the beginning of your C++ learning experience, and then continue to learn new features of the package as the term progresses.

Overview

The source code that makes use of this utilities package must include the utilities.h header file, and link to the corresponding object file (which is named utilities.obj under Windows, and may be named utilities.o under Linux, for example). Note as well that the package is enclosed in namespace Scobey.

The package contains features in four categories, as listed below.

  1. Fifteen free functions:
    Note that each member of the Read* sequence of free functions in the list above provides the same kind of service: it prompts for, and then reads in, from the standard input, a single value of the type suggested by the function name. Only ReadInt and ReadDouble contain error checking, and each continues to prompt the user for a value of the correct type until a value of that type is entered by the user (a potential infinite loop).
    • ClearScreen
    • DisplayOpeningScreen (implemented as an inline function)
    • DisplayTextfile
    • gcd
    • isEven
    • isOdd
    • numberOfDigits
    • Pause
    • ReadChar
    • ReadDouble
    • ReadInt
    • ReadNextLine
    • ReadThisLine
    • ReadString
    • userSaysYes
  2. Five utility classes:
    • Menu
    • OperationCounter
    • RandomGenerator
    • Stopwatch
    • TextItems
  3. Eleven named constants:
    • CARD_DECK
    • DAYS_OF_THE_WEEK_LONG
    • DAYS_OF_THE_WEEK_SHORT
    • DEFAULT_PROGRAMMER_INFO
    • DEFAULT_PROGRAM_INFO
    • MONTHS_OF_THE_YEAR_LONG
    • MONTHS_OF_THE_YEAR_SHORT
    • NAMES_3CHAR
    • NAMES_FEMALE
    • NAMES_MALE
    • NAMES_FAMILY
  4. One typedef (deprecated, since there should be no further need for this)
    • String80

Among the eleven named constants listed above there are these three constant arrays containing names: NAMES_FEMALE (300 first names for females), NAMES_MALE (300 first names for males), and NAMES_FAMILY (100 family names), all ranked in the order of name frequency as observed in the United States and reported on the Internet at these sites:

  1. www.census.gov/genealogy/names/dist.female.first
  2. names.mongabay.com/male_names_alpha.htm
  3. en.wikipedia.org/wiki/List_of_most_common_surnames