Computer Science Teacher
Computer Science Teacher - Thoughts and Information from Alfred Thompson

July, 2006

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Getting Together at NECC

    • 2 Comments

    Well it is about 48 hours until I take off for NECC. I’m really looking forward to it. On Wednesday night from 7 until 9 Microsoft is hosting a reception. I’m supposed to be there for work but I think I can get a bunch of invitations for others (it is a customer event after all) so if people would like to come an meet up there come find me and get an invitation. I will try to be around the Microsoft booth much of the afternoon. I will also be hosting a Birds of a Feather session for Visual basic teachers that (unfortunately) runs at the same time as the SIGCS meeting. I really feel bad about missing that one. On the other hand, in theory at least, the CIGCS meeting runs longer than the BOF so my plan is to drop by and see who I can see. I will try to bring some invitations to the Microsoft reception so I can bring as many friends and people who want to be friends as I can. So I hope to see as many of you who are going to NECC as possible.

    There is an educational bloggers get together on Thursday night. (Details here) I hope to make that one as well. And if you are going to the CS & IT event run by the CSTA and proudly sponsored by Microsoft on Saturday the 8th you will definitely see me there.

    Tags: necc necc06

     

  • Computer Science Teacher - Thoughts and Information from Alfred Thompson

    Fun with the Console (C++)

    • 0 Comments

    Since I brought up C++ the other day I’ve had a few questions in email. Some of the common questions I get revolve around doing more interesting things with the console. By interesting I mean different colors, placing the cursor at specific parts of the screen and the like. You know, all those things we used to do the hard way back in the day before really GUI (Graphical User Interface) objects like we have today with Windows Forms or some of the objects available in Java with Swing. Well I have good news for you. Using a modern C++ compiler like the one in Visual Studio 2005 does not mean you can’t do all that fun stuff.

    Today I decided to play with a bit of it. The object you want to use is the Console object and you want to have the IDE create a CLR Console application. The following code is fairly self-explanatory. Console::Title sets the title of the DOS/Console window that is opened. The code in the loop sets the background color to black and prints out two spaces to replace characters in row 10 and position i. Then a sort of arrow (foreground already set to red) is printed on a white background. Then a sleep. Note that you need to add using namespace System::Threading;” after the line that says “using namespace System;for the call to the Threading object to work. The

        int i;

        Console::Title = "Rocket Ship?";

        Console::CursorTop = 10;

        Console::ForegroundColor = ConsoleColor::Red;

        for (i=0; i < 76; i++)

        {

            Console::BackgroundColor = ConsoleColor::Black;

            Console::CursorLeft = i;

            Console::Write(L" ");

            Console::BackgroundColor = ConsoleColor::White;    

            Console::Write(L"->");

            Thread::Sleep(10);

        }

    There are other methods available like Clear and Beep and more. Give it a try if you do interesting console applications with your students. Since this Console object is part of .NET you can do the same kind of things in console applications written in C# or Visual Basic as well.

Page 9 of 9 (26 items) «56789