{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

7.Sequencing(B)(c++) - Control Structures(B Topics to cover...

Info iconThis preview shows pages 1–7. Sign up to view the full content.

View Full Document Right Arrow Icon
Control Structures (B) Topics to cover here: Sequencing in C++ language
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Coding (Writing a Program) After testing your algorithm, you can code it in any programming language. In our lab, we are going to use C++ language. First, we have to see the C++ language elements and syntax that correspond to what we have studied in the algorithmic language. Note that most of the syntax used in the pseudo code is similar to that of C++, with miner differences. Then, we convert all previous given algorithms into C++ programs.
Background image of page 2
C++ Language Elements The general form of a C++ program // File: filename // Program description # include compiler directives void main ( ) //main function of the program { //declarations section //executable statement section }
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
1- Comments in Programs In C++, the two symbols // are used to denote a program comment. If comments need more than one line, then you can use the symbols /* to begin comment and */ to end it. Usually, the first line of comment is the one that contains the file name.
Background image of page 4
2- The include compiler directive The line begins with #include represents a compiler directive. A compiler directive is processed at compilation time. C++ syntax : # include <filename> The #include statement instructs the compiler to insert the indicated C++ instructions (of the filename ) into the program in place of the directive.
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
e.g. #include <iostream.h> iostream.h is the name of a C++ library header file whose contents are inserted in place of the #include line during compilation.
Background image of page 6
Image of page 7
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}