Sie sind auf Seite 1von 2

DISCUSSION At this lab, the students have learned about the introduction to Microsoft Visual C++ 6.0.

At the end of this lesson, the students should be able to editing, compiling and running Visual C++ programs. Besides, the students know how to write a simple C++ program. The students have write 3 simple C++ program. There are Exercise 1, Exercise 2, and Exercise 3. C++ programs is made of a few important components. There are :

Comments  Comments are used to insert remarks into the source code help to explain about what the program does. In C++, comments can be place anywhere in the programs. It can be used to include the details of the project and the programmer who wrote or modified the code.

a) Single line Comment  This type of comment is used with the // (double slash) symbol and it stops at the end of that particular line. This type of comment can be used when the remark is only 1 line in length.

Header Files  Header files contain information that is required to run a program. It is a pre written and tested function that comes together with the compiler and is available for the use of the programmers. The format or structure for using the header file is by using the #include directive. The second line in our program 2.1 #include <iostream.h> is called an include preprocessor directive. As the file is placed before program the program proper , it is called a header file (with the file extension .h)

Functions  A function is a block of statements that is part of a large programme. a. Function main( )  A C++ program must have at least the function main( ). Every C++ function, including main( ), must have a body enclosed in braces { }. b. Function block { }  The function body, also called block can be of any size. The function always ends with the return command. { } - begin block - end block

Das könnte Ihnen auch gefallen