Utilities Package
Version Linux2023.0
|
Go to the documentation of this file.
117 {
"AS",
"2S",
"3S",
"4S",
"5S",
"6S",
"7S",
118 "8S",
"9S",
"TS",
"JS",
"QS",
"KS",
119 "AH",
"2H",
"3H",
"4H",
"5H",
"6H",
"7H",
120 "8H",
"9H",
"TH",
"JH",
"QH",
"KH",
121 "AD",
"2D",
"3D",
"4D",
"5D",
"6D",
"7D",
122 "8D",
"9D",
"TD",
"JD",
"QD",
"KD",
123 "AC",
"2C",
"3C",
"4C",
"5C",
"6C",
"7C",
124 "8C",
"9C",
"TC",
"JC",
"QC",
"KC"
133 {
"Monday",
"Tuesday",
"Wednesday",
"Thursday",
134 "Friday",
"Saturday",
"Sunday"
142 {
"Mon",
"Tue",
"Wed",
"Thu",
151 "Descriptive text required here is specificed elsewhere.";
158 "Lastname:Firstname:A00123456:u##";
165 {
"January",
"February",
"March",
"April",
166 "May",
"June",
"July",
"August",
167 "September",
"October",
"November",
"December"
175 {
"Jan",
"Feb",
"Mar",
"Apr",
"May",
"Jun",
176 "Jul",
"Aug",
"Sep",
"Oct",
"Nov",
"Dec"
184 {
"Ace",
"Ali",
"Amy",
"Ann",
"Art",
185 "Ben",
"Bob",
"Cal",
"Dan",
"Del",
186 "Don",
"Dot",
"Eva",
"Eve",
"Fay",
187 "Gil",
"Guy",
"Hal",
"Ian",
"Jan",
188 "Jim",
"Jon",
"Kay",
"Ken",
"Kim",
189 "Liz",
"Mac",
"Min",
"Nan",
"Ora",
190 "Pam",
"Red",
"Rex",
"Rik",
"Rip",
191 "Rob",
"Rod",
"Rog",
"Ron",
"Roy",
192 "Sal",
"Sam",
"Sue",
"Tad",
"Tim",
193 "Tom",
"Uma",
"Val",
"Wes",
"Zig"
202 {
"Smith",
"Johnson",
"Williams",
"Brown",
"Jones",
203 "Miller",
"Davis",
"Garcia",
"Rodriguez",
"Wilson",
204 "Martinez",
"Anderson",
"Taylor",
"Thomas",
"Hernandez",
205 "Moore",
"Martin",
"Jackson",
"Thompson",
"White",
206 "Lopez",
"Le",
"Gonzalez",
"Harris",
"Clark",
207 "Lewis",
"Robinson",
"Walker",
"Perez",
"Hall",
208 "Young",
"Allen",
"Sanchez",
"Wright",
"King",
209 "Scott",
"Green",
"Baker",
"Adams",
"Nelson",
210 "Hill",
"Ramirez",
"Campbell",
"Mitchell",
"Roberts",
211 "Carter",
"Phillips",
"Evans",
"Turner",
"Torres",
212 "Parker",
"Collins",
"Edwards",
"Stewart",
"Flores",
213 "Morris",
"Nguyen",
"Murphy",
"Rivera",
"Cook",
214 "Rogers",
"Morgan",
"Peterson",
"Cooper",
"Reed",
215 "Bailey",
"Bell",
"Gomez",
"Kelly",
"Howard",
216 "Ward",
"Cox",
"Diaz",
"Richardson",
"Wood",
217 "Watson",
"Brooks",
"Bennett",
"Gray",
"James",
218 "Reyes",
"Cruz",
"Hughes",
"Price",
"Myers",
219 "Long",
"Foster",
"Sanders",
"Ross",
"Morales",
220 "Powell",
"Sullivan",
"Russell",
"Ortiz",
"Jenkins",
221 "Gutierrez",
"Perry",
"Butler",
"Barnes",
"Fisher"
230 {
"Mary",
"Patricia",
"Linda",
"Barbara",
"Elizabeth",
"Jennifer",
231 "Maria",
"Susan",
"Margaret",
"Dorothy",
"Lisa",
"Nancy",
232 "Karen",
"Betty",
"Helen",
"Sandra",
"Donna",
"Carol",
233 "Ruth",
"Sharon",
"Michelle",
"Laura",
"Sarah",
"Kimberly",
234 "Deborah",
"Jessica",
"Shirley",
"Cynthia",
"Angela",
"Melissa",
235 "Brenda",
"Amy",
"Anna",
"Rebecca",
"Virginia",
"Kathleen",
236 "Pamela",
"Martha",
"Debra",
"Amanda",
"Stephanie",
"Carolyn",
237 "Christine",
"Marie",
"Janet",
"Catherine",
"Frances",
"Ann",
238 "Joyce",
"Diane",
"Alice",
"Julie",
"Heather",
"Teresa",
239 "Doris",
"Gloria",
"Evelyn",
"Jean",
"Cheryl",
"Mildred",
240 "Katherine",
"Joan",
"Ashley",
"Judith",
"Rose",
"Janice",
241 "Kelly",
"Nicole",
"Judy",
"Christina",
"Kathy",
"Theresa",
242 "Beverly",
"Denise",
"Tammy",
"Irene",
"Jane",
"Lori",
243 "Rachel",
"Marilyn",
"Andrea",
"Kathryn",
"Louise",
"Sara",
244 "Anne",
"Jacqueline",
"Wanda",
"Bonnie",
"Julia",
"Ruby",
245 "Lois",
"Tina",
"Phyllis",
"Norma",
"Paula",
"Diana",
246 "Annie",
"Lillian",
"Emily",
"Robin",
"Peggy",
"Crystal",
247 "Gladys",
"Rita",
"Dawn",
"Connie",
"Florence",
"Tracy",
248 "Edna",
"Tiffany",
"Carmen",
"Rosa",
"Cindy",
"Grace",
249 "Wendy",
"Victoria",
"Edith",
"Kim",
"Sherry",
"Sylvia",
250 "Josephine",
"Thelma",
"Shannon",
"Sheila",
"Ethel",
"Ellen",
251 "Elaine",
"Marjorie",
"Carrie",
"Charlotte",
"Monica",
"Esther",
252 "Pauline",
"Emma",
"Juanita",
"Anita",
"Rhonda",
"Hazel",
253 "Amber",
"Eva",
"Debbie",
"April",
"Leslie",
"Clara",
254 "Lucille",
"Jamie",
"Joanne",
"Eleanor",
"Valerie",
"Danielle",
255 "Megan",
"Alicia",
"Suzanne",
"Michele",
"Gail",
"Bertha",
256 "Darlene",
"Veronica",
"Jill",
"Erin",
"Geraldine",
"Lauren",
257 "Cathy",
"Joann",
"Lorraine",
"Lynn",
"Sally",
"Regina",
258 "Erica",
"Beatrice",
"Dolores",
"Bernice",
"Audrey",
"Yvonne",
259 "Annette",
"June",
"Samantha",
"Marion",
"Dana",
"Stacy",
260 "Ana",
"Renee",
"Ida",
"Vivian",
"Roberta",
"Holly",
261 "Brittany",
"Melanie",
"Loretta",
"Yolanda",
"Jeanette",
"Laurie",
262 "Katie",
"Kristen",
"Vanessa",
"Alma",
"Sue",
"Elsie",
263 "Beth",
"Jeanne",
"Vicki",
"Carla",
"Tara",
"Rosemary",
264 "Eileen",
"Terri",
"Gertrude",
"Lucy",
"Tonya",
"Ella",
265 "Stacey",
"Wilma",
"Gina",
"Kristin",
"Jessie",
"Natalie",
266 "Agnes",
"Vera",
"Willie",
"Charlene",
"Bessie",
"Delores",
267 "Melinda",
"Pearl",
"Arlene",
"Maureen",
"Colleen",
"Allison",
268 "Tamara",
"Joy",
"Georgia",
"Constance",
"Lillie",
"Claudia",
269 "Jackie",
"Marcia",
"Tanya",
"Nellie",
"Minnie",
"Marlene",
270 "Heidi",
"Glenda",
"Lydia",
"Viola",
"Courtney",
"Marian",
271 "Stella",
"Caroline",
"Dora",
"Jo",
"Vickie",
"Mattie",
272 "Terry",
"Maxine",
"Irma",
"Mabel",
"Marsha",
"Myrtle",
273 "Lena",
"Christy",
"Deanna",
"Patsy",
"Hilda",
"Gwendolyn",
274 "Jennie",
"Nora",
"Margie",
"Nina",
"Cassandra",
"Leah",
275 "Penny",
"Kay",
"Priscilla",
"Naomi",
"Carole",
"Brandy",
276 "Olga",
"Billie",
"Dianne",
"Tracey",
"Leona",
"Jenny",
277 "Felicia",
"Sonia",
"Miriam",
"Velma",
"Becky",
"Bobbie",
278 "Violet",
"Kristina",
"Toni",
"Misty",
"Mae",
"Shelly",
279 "Daisy",
"Ramona",
"Sherri",
"Erika",
"Katrina",
"Claire"
288 {
"James",
"John",
"Robert",
"Michael",
"William",
"David",
289 "Richard",
"Charles",
"Joseph",
"Thomas",
"Christopher",
"Daniel",
290 "Paul",
"Mark",
"Donald",
"George",
"Kenneth",
"Steven",
291 "Edward",
"Brian",
"Ronald",
"Anthony",
"Kevin",
"Jason",
292 "Matthew",
"Gary",
"Timothy",
"Jose",
"Larry",
"Jeffrey",
293 "Frank",
"Scott",
"Eric",
"Stephen",
"Andrew",
"Raymond",
294 "Gregory",
"Joshua",
"Jerry",
"Dennis",
"Walter",
"Patrick",
295 "Peter",
"Harold",
"Douglas",
"Henry",
"Carl",
"Arthur",
296 "Ryan",
"Roger",
"Joe",
"Juan",
"Jack",
"Albert",
297 "Jonathan",
"Justin",
"Terry",
"Gerald",
"Keith",
"Samuel",
298 "Willie",
"Ralph",
"Lawrence",
"Nicholas",
"Roy",
"Benjamin",
299 "Bruce",
"Brandon",
"Adam",
"Harry",
"Fred",
"Wayne",
300 "Billy",
"Steve",
"Louis",
"Jeremy",
"Aaron",
"Randy",
301 "Howard",
"Eugene",
"Carlos",
"Russell",
"Bobby",
"Victor",
302 "Martin",
"Ernest",
"Phillip",
"Todd",
"Jesse",
"Craig",
303 "Alan",
"Shawn",
"Clarence",
"Sean",
"Philip",
"Chris",
304 "Johnny",
"Earl",
"Jimmy",
"Antonio",
"Danny",
"Bryan",
305 "Tony",
"Luis",
"Mike",
"Stanley",
"Leonard",
"Nathan",
306 "Dale",
"Manuel",
"Rodney",
"Curtis",
"Norman",
"Allen",
307 "Marvin",
"Vincent",
"Glenn",
"Jeffery",
"Travis",
"Jeff",
308 "Chad",
"Jacob",
"Lee",
"Melvin",
"Alfred",
"Kyle",
309 "Francis",
"Bradley",
"Jesus",
"Herbert",
"Frederick",
"Ray",
310 "Joel",
"Edwin",
"Don",
"Eddie",
"Ricky",
"Troy",
311 "Randall",
"Barry",
"Alexander",
"Bernard",
"Mario",
"Leroy",
312 "Francisco",
"Marcus",
"Micheal",
"Theodore",
"Clifford",
"Miguel",
313 "Oscar",
"Jay",
"Jim",
"Tom",
"Calvin",
"Alex",
314 "Jon",
"Ronnie",
"Bill",
"Lloyd",
"Tommy",
"Leon",
315 "Derek",
"Warren",
"Darrell",
"Jerome",
"Floyd",
"Leo",
316 "Alvin",
"Tim",
"Wesley",
"Gordon",
"Dean",
"Greg",
317 "Jorge",
"Dustin",
"Pedro",
"Derrick",
"Dan",
"Lewis",
318 "Zachary",
"Corey",
"Herman",
"Maurice",
"Vernon",
"Roberto",
319 "Clyde",
"Glen",
"Hector",
"Shane",
"Ricardo",
"Sam",
320 "Rick",
"Lester",
"Brent",
"Ramon",
"Charlie",
"Tyler",
321 "Gilbert",
"Gene",
"Marc",
"Reginald",
"Ruben",
"Brett",
322 "Angel",
"Nathaniel",
"Rafael",
"Leslie",
"Edgar",
"Milton",
323 "Raul",
"Ben",
"Chester",
"Cecil",
"Duane",
"Franklin",
324 "Andre",
"Elmer",
"Brad",
"Gabriel",
"Ron",
"Mitchell",
325 "Roland",
"Arnold",
"Harvey",
"Jared",
"Adrian",
"Karl",
326 "Cory",
"Claude",
"Erik",
"Darryl",
"Jamie",
"Neil",
327 "Jessie",
"Christian",
"Javier",
"Fernando",
"Clinton",
"Ted",
328 "Mathew",
"Tyrone",
"Darren",
"Lonnie",
"Lance",
"Cody",
329 "Julio",
"Kelly",
"Kurt",
"Allan",
"Nelson",
"Guy",
330 "Clayton",
"Hugh",
"Max",
"Dwayne",
"Dwight",
"Armando",
331 "Felix",
"Jimmie",
"Everett",
"Jordan",
"Ian",
"Wallace",
332 "Ken",
"Bob",
"Jaime",
"Casey",
"Alfredo",
"Alberto",
333 "Dave",
"Ivan",
"Johnnie",
"Sidney",
"Byron",
"Julian",
334 "Isaac",
"Morris",
"Clifton",
"Willard",
"Daryl",
"Ross",
335 "Virgil",
"Andy",
"Marshall",
"Salvador",
"Perry",
"Kirk",
336 "Sergio",
"Marion",
"Tracy",
"Seth",
"Kent",
"Terrance",
337 "Rene",
"Eduardo",
"Terrence",
"Enrique",
"Freddie",
"Wade"
368 int numBlankLinesBefore = 11,
369 int numBlankLinesAfter = 12
418 const string& fileName,
419 int numberOfLinesPerPause = 23
572 const string& userPrompt,
594 const string& userPrompt,
622 const string& userPrompt,
650 const string& userPrompt,
672 const string& userPrompt,
696 const string& userPrompt,
716 const string& question
772 const string& menuTitle
800 const string& menuTitle
891 "Enter the number of your menu choice here and press Enter: "
942 static const int MAX_NUM_OPTIONS = 20;
943 static const int MAX_OPTION_LENGTH = 70;
944 static const int MAX_TITLE_LENGTH = 70;
949 vector<string> menuText;
1092 string nameOfOtherOp
1174 string nameOfOtherOp;
1409 const string& first,
1410 const string& second
1435 const string& first,
1436 const string& second
1473 const string& source
1491 void my_srand(
int& seed);
1517 const string nameOfEventToBeTimed
1528 const string nameOfEventToBeTimed
1671 clock_t numClockTicksPassed;
1761 const string fileName
1814 vector< vector<string> > itemList;
1822 const string& programmerInfo,
1823 const string& programInfo,
1824 int numBlankLinesBefore,
1825 int numBlankLinesAfter
1828 string blankLinesBefore(numBlankLinesBefore,
'\n'),
1829 blankLinesAfter(numBlankLinesAfter,
'\n');
1830 cout << blankLinesBefore
1833 <<
"\nThe main driver of this executable was built on "
1834 << __DATE__ <<
" at " << __TIME__ <<
".\n"
bool isOdd(int n)
Determines if a positive integer is odd.
Definition: utilities.cpp:161
void reset()
Resets all operation counters to zero and the name of the "other" operation, if any,...
Definition: utilities.cpp:540
const string NAMES_FEMALE[]
Provides 300 female first names, ranked in order of frequency as found in the United States of Americ...
Definition: utilities.h:229
string getNextStringFromString(int size, const string &source)
Gets a pseudorandom string containing size characters taken from the string s.
Definition: utilities.cpp:916
OperationCounter()
Default constructor.
Definition: utilities.cpp:535
int getNumberOfExchanges() const
Gets the number of exchange operations counted.
Definition: utilities.cpp:592
char String80[81]
Provides a legacy C-string type for holding up to 80 characters of text.
Definition: utilities.h:106
Contains one typedef, eleven named constants, fifteen free functions, and five utility classes.
Definition: utilities.h:100
RandomGenerator()
Default constructor, based on seed obtained from a call to the time() function.
Definition: utilities.cpp:685
const string DAYS_OF_THE_WEEK_LONG[]
Provides full names for days of the week.
Definition: utilities.h:132
double getMinutes() const
Gets the number of minutes between the last calls of start() and stop().
Definition: utilities.cpp:1004
double getNextDouble(double x)
Same as getNext(double x) above, but with a more explicit name, for readability rather than for ease ...
Definition: utilities.cpp:779
void incrementComparisons(int numTimes=1)
Increments the counter for the number of comparison operations.
Definition: utilities.cpp:560
void stop()
Causes the stopwatch to stop running.
Definition: utilities.cpp:969
double getHours() const
Gets the number of hours between the last calls of start() and stop().
Definition: utilities.cpp:1010
void ReadNextLine(const string &userPrompt, string &lineValue)
Reads the text entered by a user on the line following the prompt.
Definition: utilities.cpp:275
void DisplayTextfile(const string &fileName, int numberOfLinesPerPause=23)
Displays a file of text numberOfLinesPerPause lines at a time.
Definition: utilities.cpp:87
void incrementOtherOp(int numTimes=1)
Increments the counter for the number of "other" operations.
Definition: utilities.cpp:578
int getNextInt(int n)
Same as getNext(int n) above, but with a more explicit name, for readability rather than for ease of ...
Definition: utilities.cpp:741
const string NAMES_3CHAR[]
Provides fifty 3-character first names, some male and some female, in alphabetical order.
Definition: utilities.h:183
int getNumberOfAssignments() const
Gets the number of assignment operations counted.
Definition: utilities.cpp:598
void start()
Causes the stopwatch to start running.
Definition: utilities.cpp:963
const string DEFAULT_PROGRAM_INFO
Provides a placeholder value for a program title or brief description.
Definition: utilities.h:150
void displayItem(const string title) const
Definition: utilities.cpp:1127
void setEventName(const string nameOfEventToBeTimed)
Sets, or resets, the name of the event to be timed.
Definition: utilities.cpp:949
TextItems()
Definition: utilities.cpp:1049
void ReadInt(const string &userPrompt, int &intValue)
Gets an integer (int) value from the user.
Definition: utilities.cpp:257
bool isEven(int n)
Determines if a positive integer is even.
Definition: utilities.cpp:150
Stopwatch()
Default constructor.
Definition: utilities.cpp:932
void setNameOfOtherOp(string nameOfOtherOp)
Sets (or resets) the name of the "other" operation.
Definition: utilities.cpp:611
string getNameOfOtherOp() const
Gets the name of the "other" operation.
Definition: utilities.cpp:619
void DisplayOpeningScreen(const string &programmerInfo=DEFAULT_PROGRAMMER_INFO, const string &programInfo=DEFAULT_PROGRAM_INFO, int numBlankLinesBefore=11, int numBlankLinesAfter=12)
Displays an opening screen for any console program.
Definition: utilities.h:1821
const string DAYS_OF_THE_WEEK_SHORT[]
Provides 3-letter abbreviations for days of the week.
Definition: utilities.h:141
For measuring the time taken by an algorithm to perform its task.
Definition: utilities.h:1497
void ReadChar(const string &userPrompt, char &charValue)
Gets a character (char) value from the user.
Definition: utilities.cpp:209
For displaying on-line help and other text messages in console applications.
Definition: utilities.h:1676
string getEventName() const
Gets the current name of the event to be timed.
Definition: utilities.cpp:957
void 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...
Definition: utilities.cpp:189
void incrementAssignments(int numTimes=1)
Increments the counter for the number of assignment operations.
Definition: utilities.cpp:551
const string DEFAULT_PROGRAMMER_INFO
Provides a placeholder value for programmer identification information.
Definition: utilities.h:157
string getNextStringFromCharRange(int size, char firstChar, char lastChar)
Gets a pseudorandom string containing size characters from the character range [firstChar,...
Definition: utilities.cpp:900
void reset()
Resets the random generator using a seed obtained by a call to the time() function.
Definition: utilities.cpp:702
void ReadDouble(const string &userPrompt, double &doubleValue)
Gets a real (double) value from the user.
Definition: utilities.cpp:229
int getNumberOfComparisons() const
Gets the number of comparison operations counted.
Definition: utilities.cpp:586
void ReadString(const string &userPrompt, string &stringValue)
Gets a whitespace-delimited string value from the user.
Definition: utilities.cpp:295
void display() const
Definition: utilities.cpp:1016
For generating pseudorandom integer, real, character and string values.
Definition: utilities.h:1179
void incrementExchanges(int numTimes=1)
Increments the counter for the number of exchange operations.
Definition: utilities.cpp:569
void ReadThisLine(const string &userPrompt, string &lineValue)
Reads the text entered by a user on the same line as the prompt.
Definition: utilities.cpp:285
string getNextString(const string &s)
Same as getNext(const string& s) above, but with a more explicit name, for readability rather than fo...
Definition: utilities.cpp:879
clock_t getTicks() const
Gets the number of clock ticks between the most recent calls of start() and stop().
Definition: utilities.cpp:992
void displayAllCounts() const
Definition: utilities.cpp:645
const string NAMES_MALE[]
A named constant containing 300 male first names, 6 per line, ranked in order of frequency as found i...
Definition: utilities.h:287
void displayNonZeroCounts() const
Definition: utilities.cpp:625
double getSeconds() const
Gets the number of seconds between the last calls of start() and stop().
Definition: utilities.cpp:998
const string CARD_DECK[]
Provides 2-character representations of each of the fifty-two cards in a standard deck of cards.
Definition: utilities.h:116
void ClearScreen(int numLines=25)
Clears the screen (the default output stream, which is assumed by default to have 25 lines).
Definition: utilities.cpp:75
int gcd(int a, int b)
Finds the greatest common divisor of two nonnegative integers, at least one of which is strictly posi...
Definition: utilities.cpp:131
void delay(int delayFactor=1) const
Adds some multiple of an artifical amount of time to the accumulated time on the stopwatch.
Definition: utilities.cpp:976
const string MONTHS_OF_THE_YEAR_LONG[]
Provides full names for months of the year.
Definition: utilities.h:164
int getNext(int n)
Gets a pseudorandom integer in the range [0,n).
Definition: utilities.cpp:722
int getNumberOfOtherOp() const
Gets the number of "other" operations performed.
Definition: utilities.cpp:604
bool userSaysYes(const string &question)
Gets the user's yes-or-no answer to a single question.
Definition: utilities.cpp:308
const string MONTHS_OF_THE_YEAR_SHORT[]
Provides 3-letter abbreviations for months of the year.
Definition: utilities.h:174
For counting operations performed by an algorithm.
Definition: utilities.h:957
int numberOfDigits(int n)
Finds the number of digits in a positive integer.
Definition: utilities.cpp:172
const string NAMES_FAMILY[]
Provides 100 family names (surnames), ranked in order of frequency as found in the United States of A...
Definition: utilities.h:201