CS 150 Introduction to C++ Programming - Spring 1998 

[ Home | Lecture Notes| WebTutor | WebTutor Site Map]


Lab 1


The purpose of this exercise is to shown the structure of a simple C++ program.

Key Concepts are:

  1. commenting
  2. the "main" function
  3. printing output

See if you can identify these concepts in the following program.

 

Line Number

Program

1
2
3
4
5
6
7
8
//Description: Simple C++ program

#include <iostream.h>
int main()
{
   cout <<" Welcome to cs150 " <<endl;
   return 0;
}
Answer the following questions:
  1. Which line(s) contain a comment?
    Line 1  Line 2  Line 3  Line 4
    Line 5  Line 6  Line 7  Line 8
    
  2. Which line(s) form the skeleton of a C++ program, which must be present for every C++ program?:
    Line 1  Line 2  Line 3  Line 4
    Line 5  Line 6  Line 7  Line 8
    
  3. Which line(s) cause the program to print out a message?
    Line 1  Line 2  Line 3  Line 4
    Line 5  Line 6  Line 7  Line 8
    
  4. Which line(s) tell the compiler to include the Input Output library?:
    Line 1  Line 2  Line 3  Line 4
    Line 5  Line 6  Line 7  Line 8
    Choose one when done
     

Copyright chris wild 1998.
For problems or questions regarding this web contact [Dr. Wild].
Last updated: January 24, 1998.