Vous êtes sur la page 1sur 7

Assignment In C++ Programming

Question:1.What is C++
-C++ (pronounced cee plus plus) is a general purpose programming language. It
has imperative, object-oriented and genericprogramming features, while also providing the facilities
for low level memory manipulation.
It is designed with a bias for systems programming (e.g. embedded systems, operating system
kernels), with performance, efficiency and flexibility of use as its design requirements. C++ has also
been found useful in many other contexts, including desktop applications, servers (e.g. ecommerce, web search, SQL), performance critical applications (e.g. telephone switches, space
probes) and entertainment software, such as video games.[3]

2.Who is Written C++

Bjarne Stroustrup
Bjarne Stroustrup (Danish: born 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 singn 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
with expressions but indications for the compiler's
preprocessor. In this case the directive #include
<iostream> tells the preprocessor to include the iostream
standard file. This specific file (iostream)
includes the declarations of the basic standard inputoutput library in C++, and it is included because its
functionality is going to be used later in the program.

c) Iostream.h
Iostream.h is C++ programming objects inherit all member
from both instream (instream) and ostream.(outstream) this
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,
independently of its location within the source code. It
does not matter whether there are other functions with
other names defined before or after it - the
instructions contained within this function's definition will
always be the first ones to be executed in any
C++ program. For that same reason, it is essential that all
C++ programs have a main function.
e) Function
Allow to structure programs in segments of code to perform
individual tasks.
f) Cout
cout represents the standard output stream in C++, and the
meaning of the entire statement is to insert
a sequence of characters (in this case the Hello World
sequence of characters) into the standard output
stream (which usually is the screen).
cout is declared in the iostream standard file within the std
namespace, so that's why we needed to
include that specific file and to declare that we were going
to use this specific namespace earlier in our
code.

g) <<
The bitwise left shift to shifts operator bits to the left.

h) Hello World\n;
-This line is a C++ statement. A statement is a simple or
compound expression that can actually produce
some effect. In fact, this statement performs the only action that
generates a visible effect in our first
program.
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 return statement causes the main function to finish.
return may be followed by a return code (in our
example is followed by the return code 0). A return code of
0 for the main function is generally interpreted
as the program worked as expected without any errors
during its execution. This is the most usual way to
end a C++ console program.

4.Give 5 mathemathical operators and 6 relational operators:


Mathematical Operators
Symbol

Relational Operators

Meaning

Symbol

Meaning

Addition

Has a value of

Subtraction

<

Less than

Multiplication

>

Greater than

Division

<=

Less than or equal to

Exponents

>=

Greater than or equal to

<>

Not equal to

5.Statement 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.

Vous aimerez peut-être aussi