Lab Assignment 1

Tasks

  1. Basics of Visual Studio
    Follow the instructions at this URL for creating a new visual studio project and program that outputs "Hello World".
    http://cs.uc.edu/~flannert/resources/vs2005/
    The source code for the "Hello World" program can be copy-and-pasted from this file:
    HelloWorld.cpp
    Make sure you can compile and run the file, and that it works correctly.
    Once you have done that, quit Visual Studio and create a ZIP file of your project.
    Email me the ZIP file. Make sure the subject is "CS121 Summer 2008 Lab 1 Task 1"

    This is simply to get you used to working with Visual Studio "Projects", which you will use for virtually all of your homeworks/lab assignments.


  2. Simple Debugging Lesson
    For each of the following files, copy the contents of the file into a new project and try to compile and run the programs. Each program is supposed to do the following. If there are any errors OR warnings reported by Visual Studio, try to understand what the errors/warning are and see if you can correct them.
    Write a document (in Word format, Notepad, etc.) that contains the following information for each of the four programs.
    1. If there were any errors/warnings, and if so how many.
    2. What each error/warning meant. I don't want what a copy of the error/warning message itself, but rather what the cause of the error/warning is.
    3. If you can fix the program to prevent the error/warning message and successfully compile and run the program, describe what you had to change.
    When you are finished, print out your report and hand it to me. Additionally, email me your report. Make sure the subject is "CS121 Summer 2008 Lab 1 Task 2"

    The files are:

    This is to get you used to working with the debugger and common errors.
    Don't be afraid to play around!


  3. Extending an Existing Program
    Now, download the following file, which correctly performs the task that the above 4 programs tried to do.
    Correct.cpp
    In addition to its current task, extend the program to do the following, after the larger of the two numbers is reported: From what you see in the program, you should be able to figure this out. Again, you don't have to get it right the first time, and I certainly don't expect you to know how to write any C++ after only 2 hours of class! (NOTE: Wednesday will be different, however!)

    Once you have the program modified and working correctly, email me a copy of your source code, making sure the subject is "CS121 Summer 2008 Lab 1 Task 3". Additionally, print out your source code and hand it to me.


  4. Playing with C++
    Download, compile, and run the following program. Again, you are not expected to understand any of this code at this point in the class!
    mystery.cpp

    It's a semi-large program, broken into functions (modules -- you'll learn what those are later), that does something. It's reasonably well written and has some documentation (the comments throughout the code).

    I want you to figure out what it does (this will be obvious once you run the program), but more importantly, I want you to look through the code and get some idea of how such a program can be written, and what certain pieces of code do.

    Start reading the file line-by-line from top-to-bottom. Try to see how much of the code you can figure out.
    Once you've stared at it long enough, attempt the following:
    1. Modify the program so that empty squares are shown as periods (.) rather than spaces.
    2. How is the computer currently "making its move"? Can you think of a more intelligent approach? (Probably so!)
      More importantly, from what you see, do you think you could modify the program to make more intelligent moves?
      Try to do so.
    When you are finished, write a (very) brief report where you describe what the program does and roughly how it works (to the best of your current understanding).
    Print out copies of both your report and source code and hand them in to me. Additionally, meail me a copy making sure the subject is "CS121 Summer 2008 Lab 1 Task 4".