Source of TestStuff20141006Lab.cpp


  1: //TestStuff20141006Lab.cpp

  2: //Monday, October 6, 2014

  3: 
  4: #include <iostream>

  5: #include <fstream>

  6: #include <iomanip>

  7: #include <string> 

  8: #include <cstdlib>

  9: #include <vector>

 10: using namespace std;
 11: 
 12: #include "utilities.h"

 13: using Scobey::Pause;
 14: using Scobey::ReadInt;
 15: using Scobey::ReadString;
 16: using Scobey::userSaysYes;
 17: using Scobey::Menu;
 18: using Scobey::RandomGenerator;
 19: 
 20: int main(int argc, char* argv[])
 21: {
 22:     Menu menu;
 23:     menu.setTitle("Menu");
 24:     menu.addOption("Quit");
 25:     menu.addOption("Get info");
 26:     menu.addOption("Generate random strings");
 27: 
 28:     int menuChoice;
 29:     do
 30:     {
 31:         menu.display();
 32:         menuChoice = menu.getChoice();
 33:         switch (menuChoice)
 34:         {
 35:         case 1:
 36:         case -1:
 37:             Pause(0, "Program terminating.");
 38:             break;
 39:         case 2:
 40:             Pause(0,"Here's some info ...");
 41:             break;
 42:         case 3:
 43:             do
 44:             {
 45:                 RandomGenerator randGen;
 46:                 string s;
 47:                 ReadString("Enter a word: ", s);
 48:                 for (int i = 1; i <= 10; i++)
 49:                 {
 50:                     cout << randGen.getNextString("xxxxyyyy" + s) << endl;
 51:                 }
 52:                 Pause();
 53:             } while (userSaysYes("Do it again? "));
 54:             break;
 55:         }
 56:     } while (menuChoice != 1 && menuChoice != -1);
 57: }
 58: