You are on page 1of 6

ASSIGNMENT IN C++ PROGRAMMING

QUESTIONS
1. WHAT IS C++?
C++ is a general purpose programming language.It has imperative, objectoriented and generic programming features, while also providing the facilities
for low level memory manipulation.

2. WHO IS WRITTEN C++?


The written of C++ is Bjarne Stroustrup.

Bjarne Stroustrup born in 30 December 1950 is a Danish computer scientist,


most notable for the creation and development of the widely used C++
programming language. He is a Distinguished Research Professor and holds the
College of Engineering Chair in Computer Science at Texas A&M University, a
visiting professor at Columbia University, and works at Morgan Stanley.

3. DESCRIBE THE PURPOSE OF THE FOLLOWING SYNTAX AND GRAMMAR.


a) #
A hash sighn are directives for the pre-processor
b) #include
Lines beginning with a hash sign (#) are directives for the preprocessor. They are
not regular code lines expressions but indications for the compliers
preprocessor. In this case the directive #include <iostream> tells the
preprocessor to include the iostream standard file. This specific file (iostream)
includes the declarations the declarations of the basic standard in C++.
c) Iostream.h
Iostream.h is C++ programming objects inherit all member from both istream
(instream) and ostream.(outstream) thus being able to perform both input and
output operations.
d) Int main()
This line corresponds to the beginning of the definition of the main function.
The main function is the point by where all C++ programs start their execution,
indenpently of its location within the source code. It does not matter what
whether there are other functions with other names defined before or after it
the instructions contained within this functions definition will always be the
first ones to be executed in any C++ program.

e) Function
Allow to structure programs in segments of code to perform individual tasks.
f) Cout
Cout represent the standard output stream in C++, and the meaning of the
entire statement is to insert a sequence of characters (in this case the sequence
of characters) into the standard output stream.
g) <<
The bitwise left shift to shifts operator bits to the left.
h) Hello word\n
To make sure that a language's compiler, development environment, and runtime environment are correctly installed. Configuring a complete programming
toolchain from scratch to the point where even trivial programs can be
compiled and run can involve substantial amounts of work. For this reason, a
simple program is used first when testing a new tool chain.
i) \n
Moves the active position to the initial position of the next line.
j) ;
The separation between statements is specified with an ending semicolon at the
end of each one sentences.
k) Return 0;
The main functions returns an integer. If everything went Ok, the program
exited gracefully.

4. GIVE 5 MATHEMATICAL OPERATORS AND RELATIONAL OPERATORS:

MATHEMATICALS OPERATORS
SYMBOL
1 +
2 3 *
4 /
5 %

MEANING
Addition
Subtraction
Multiplication
Divison
Modulo

RELATIONAL OPERATORS
SYMBOL
1 ==
2 !=
3 <
4 >
5 <=
6 >=

MEANING
Equal To
Not Equal To
Less Than
Greater Than
Less Than Or Equal To
Greater Than Or Equal to

5. STATE STATEMENTS BELOW AND GIVE AN EXAMPLE APPLICATION IN C++


PROGRAM.
a) Go to.
Allow to make an absolute jump to another point in the program. This
unconditional jump ignores nesting levels, and does not cause any automatic
stack unwinding. Therefore, it is a feature to use with care, and preferably
within thee same block of statements, especially in the presence of local
variables.
b) While
Conditionally executes a statement zero or more times? As long as a Boolean
test is true.
c) Break and Continue
Break leaves a loop, even if the condition for its end is not
fulfilled. It can be used to end an infinite loop, or to forceit to
end before its natural end. For example, lets stop the
countdown before its natural end:
The continue statement cause the program to skip the rest of
the loop in the current iteration, as if the end of the statement
block had beenreached, causing it to jump to the start of the
following iteration.

d) While True
A while true statement that reapeatedly executes a target
statement as long as a given condition is true.

e) Do/While
Do statement conditionaly executes a statement one or more
times.
For statement evaluates a sequence of initialization expressions
and then, while a condition is true, repeatedly executes a
statement and evaluates a sequence of iteration expressions
f) Jump/Loop
Loop repeat a statement a certain number of times, or white a
condition is fulfilled . They are introduced by the keywords
while, do , and for.
Jump statements allow altering the flow of a program by
performing jumps to specific location.
g) If/Else
If statement selects a statement for execution base on the value
of a Boolean expression. An if statement may optionally include
an else clause that executes if the Boolean expression is false
The else clause of an if...else statement is associated with the
closest previous if statement in the same scope that does not
have a corresponding else statement.

You might also like