// Quiz2.cpp
// Program which inputs a string (C++ string class object)
// and both counts uppercase letters and determines whether
// the string contains a backslash.

#include <iostream>
#include <string>

int main()
{
   cout << "Enter anything:> ";
   string text;
   getline(cin, text);

   int countUpperCase = 0;
   bool containsBackSlash = false;

   for ( int i = 0; i < text.length(); i++ )
   {
      if ( text[i] >= 'A' && text[i] <= 'Z' )
         countUpperCase++;
      if ( text[i] == '\\' )
         containsBackSlash = true;
   }  // for i

   cout << "The string you entered contains "
           << countUpperCase << " upper case letters and ";
   if ( containsBackSlash )
      cout << "DOES";
   else
      cout << "does NOT";
   cout << " contain a back slash." << endl;

   return 0;
}  // function main