Lab 1 - Getting Started

Due - September 13/14, 2004

In this lab, you will compile and run your first program in C.
Create a new project using Microsoft Visual C++. The worksheet provided in lab will guide you through this process. Now, create a new C/C++ source file and type the following program into your source file. Compile and run the program.

/*
  * Name:
  * Date:
  * Section:
  * Filename:
  * Description: My first "hello, world" program in C.
*/
#include <stdio.h>

//the main function
int main (void)
{
   //print the phrase
   printf("Hello, world!");

   return(0);
}
  1. Make sure a lab assistant (Dianne or I) has seen your program run.
  2. Modify your program so that it prints your name instead of the default message.
  3. Again, demonstrate, to a lab assistant, that your program runs.
  4. Copy and paste the output of your program to the bottom of your program itself. Make sure the output is a comment. That means, put a /* before the output and a */ after the output.
  5. Take some time to introduce errors into your program and see what happens. For example, remove the semicolon from the end of the "printf" line. Try to compile your program. What happens? Replace the semicolon and remove a curly-brace. What happens?

Sami Rollins