topical media & game development

talk show tell print

basic-program-code-03-Ex3-16.c

? / basic-program-code-03-Ex3-16.c


  // Ex3_15.cpp : main project file.
  
  include <stdafx.h>
  
  using namespace System;
  
  int main(array<System::String ^> ^args)
  {
    wchar_t letter;                      // Corresponds to the C++/CLI Char type
    Console::Write(L"Enter a letter: ");
    letter = Console::Read();
    if(letter >= 'A')                    // Test for 'A' or larger
      if(letter <= 'Z')                  // Test for 'Z' or smaller
      {
        Console::WriteLine(L"You entered a capital letter.");
        return 0;
      }
  
    if(letter >= 'a')                    // Test for 'a' or larger
      if(letter <= 'z')                  // Test for 'z' or smaller
      {// Ex3_16.cpp : main project file.
  // Testing key presses in a loop.
  
  include <stdafx.h>
  
  using namespace System;
  
  int main(array<System::String ^> ^args)
  {
    Console::WriteLine(L"Press a key combination - press Escape to quit.");
  
    ConsoleKeyInfo keyPress;
    do
    {
      keyPress = Console::ReadKey(true);
      Console::Write(L"You pressed");
      if(safe_cast<int>(keyPress.Modifiers)>0)
        Console::Write(L" {0},", keyPress.Modifiers);
      Console::WriteLine(L" {0} which is the {1} character",
                                     keyPress.Key, keyPress.KeyChar);
  
    }while(keyPress.Key != ConsoleKey::Escape);
    return 0;
  }
  
        Console::WriteLine(L"You entered a small letter.");
        return 0;
      }
  
    Console::WriteLine(L"You did not enter a letter.");
     return 0;
  }
  


(C) Æliens 20/2/2008

You may not copy or print any of this material without explicit permission of the author or the publisher. In case of other copyright issues, contact the author.