// testContainsAsciiControl.cpp
//
// Tests the containsAsciiControl function
// declared in textUtility.h and defined
// in textUtility.cpp.  Uses it to chech
// whether an entered string contains at
// least one ASCII control character.

#include "textUtility.h"    // includes <iostream> and <string>

using namespace std;

/*
 * Prompts the user to enter a string.
 * Displays an indication of whether the string
 * contains any ASCII control characters.
 *
 * Global variables:
 *    cin - an istream object for interactive input.
 *           cin is an external variable, declared
 *           in library header file <iostream>.
 *    cout - an ostream object for output to the terminal.
 *           cout is an external variable, declared
 *           in library header file <iostream>.
 */
int main()
{
   cout << "Type something. Anything:>";

   string text;            // to be entered by the user
   getline( cin, text );   // input entire line, including spaces

   cout << "You typed:  " << text << endl;

   bool controlFound = containsAsciiControl(text);

   cout << "Your line of text ";
   if ( controlFound )
      cout << "contains at least one ASCII control character." << endl;
   else
      cout << "contains no ASCII control characters." << endl;

   return 0;
}  // function main