Combining the Above with File I/O via Redirection

Consider the following : (as Bill Nye the Science Guy would say)

// file : caps.C
#include <iostream.h>
main()
{
  char ch;

  while (cin >> ch) 
    {
      if ((ch>='a') && (ch<='z')) // is it a lower case letter?
	      ch = ch + 'A' - 'a';        // convert it to upper case
      cout << ch;                 // print it out
    }
}

New things :