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

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

View Full Document Right Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon

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

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Control Structures (B) Topics to cover here: Sequencing in C++ language 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. 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 } 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. 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. 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....
View Full Document

This note was uploaded on 02/23/2011 for the course CHEMICAL E 2 taught by Professor Hibasaadeh during the Spring '11 term at University of Jordan.

Page1 / 18

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

This preview shows document pages 1 - 7. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online