Trusted by millions of Kenyans
Study resources on Kenyaplex

Get ready-made curriculum aligned revision materials

Exam papers, notes, holiday assignments and topical questions – all aligned to the Kenyan curriculum.

Explain the features of a C++ program.

Explain the features of a C++ program.

Answers


Kavungya
1) #include: this is a compound pre-processor directive that invokes the execution of the program by the processor for linking the input – output streaming files; and that:-
i) #Symbol: this is a signal to the pre-processor (i.e. a program that is automatically called each time a compiler is run, in order to modify the code)
ii) include: this is an instruction to the pre-processor that gives direction concerning where to find the file name.
iii) iostream.h : this can be read as input-output-stream.header. It enables the capturing and outputting of data and information respectively.
iv) < >: Gives an indication that the filename is confined within it.
2) main ( ) :This is the master function which oversees the execution of the entire program.
3) Comments: are the additional ideas to make the program more understandable and can be written within:-
i) /*…*/: This is known as star-slash comment style and is used in a case where the comment runs to more than one line
ii) //: This is known as double-slash comment style and is used in a case where the comment fits in one line
4) Input / output commands: these are controls used to enable the user or programmer to interact with the computer and are as follows:-
i) cout: this is an object used to print a message to the screen. The word cout is followed by redirection operator <<)
ii) cin: this is the input command and it is followed by >> operator and allows for input of data by the user.
5) return 0 : this a signal to the Operating System that the main() function has successively executed.
6) \n or \endl : this is non-printable character that tells the cout to place the cursor in a new line
Kavungya answered the question on May 15, 2019 at 14:52

Answer Attachments

Exams With Marking Schemes

Related Questions