assignment c++ programming

10
INFORMATION TECHNOLOGY KFC 1024 ASSIGNMENT (C++ PROGRAMMING) DISEDIAKAN UNTUK: ENCIK MOHD SHUKRI BIN MUHAMMAD HUSIN DISEDIAKAN OLEH: SITI ROKIAH BINTI MOHD NOH 1601058 PROGRAM: SIJIL TEKNOLOGI KEJURUTERAAN KOMPUTER (RANGKAIAN) SESI: SEM 1 JANUARI JUN 2016

Upload: aana-solehah

Post on 10-Jul-2016

13 views

Category:

Documents


0 download

DESCRIPTION

C++ Programming

TRANSCRIPT

Page 1: Assignment C++ Programming

INFORMATION TECHNOLOGY

KFC 1024

ASSIGNMENT

(C++ PROGRAMMING)

DISEDIAKAN UNTUK: ENCIK MOHD SHUKRI BIN MUHAMMAD HUSIN

DISEDIAKAN OLEH: SITI ROKIAH BINTI MOHD NOH

1601058

PROGRAM:

SIJIL TEKNOLOGI KEJURUTERAAN KOMPUTER (RANGKAIAN)

SESI: SEM 1

JANUARI – JUN 2016

Page 2: Assignment C++ Programming

QUESTION:

1. Who is Written C++?

Bjarne Stroustrup is the designer and original implementer of C++. He is founding member of the ISO C++ standards committee and a major contributor to modern C++. He worked at Bell Labs and is now a managing director in Morgan Stanley’s technology division. He is also a visiting professor at Columbia University. He is a member of the USA National Academy of Engineering, an ACM Fellow and an IEEE Fellow.

Bjarne Stroustrup 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.

Stroustrup has a master’s degree in mathematics and computer science (1975) from Aarhus University, Denmark, and PhD in computer science (1979) from the University of Cambridge, England. His thesis advisor in Cambridge was David Wheeler.

Stroustrup began developing C++ in 1978 (then called “Cwith Classes”), and in his own words, “invented C++, wrote its early definitions, and produced its first implement. Chose and formulated the design criteria C++, designed all its major facilities, and was responsible for the processing of extension proposals in the C++ standards committee. Stroustrup also wrote a textbook for the language, The C++ Programming Language.

Stroustrup was the head of A&A Bell Labs’ Large-scale Programming

Research department, from its creation until late 2002. Stroustrup was elected member of the National Academy of Engineering in 2004. He is a Fellow of the ACM (1994) and an IEEE Fellow. He works at Texas A&M University as a Distinguished Professor where he holds the College of Engineering Endowed Chair in Computer Science. He is also a visiting faculty in Computer Science Department at Columbia University. ITMO University noble doctor since 2013.

Page 3: Assignment C++ Programming

2. State statements below and give an example application in C++ Program.

a) Go to A go to statement provides an unconditional jump from the go to a

labeled statement in the same function

Page 4: Assignment C++ Programming

b) While A while loop statement repeatedly executes a target statement as

long as a given condition is trus.

Page 5: Assignment C++ Programming

c) Break and Continue The Break statement has the following two usages in C++

When the break statement is encountered inside a loop, the loop is immediately terminated and program control resumes at the next statement following the loop

It can be used to terminate a case in the switch statement (covered in the next chapter)

Page 6: Assignment C++ Programming

The continue statement works somewhat like the break statement. Instead of forcing termination, however, continue force the next iteration of the loop to take place, skipping any code in between.

Page 7: Assignment C++ Programming

d) While True While true means that the loop will iterate forever, unless some

command inside the loop forces the loop to end. In this case, the break on line 11 will force the loop to end.

Page 8: Assignment C++ Programming

e) Do / While A do… while loop is similar to a while loop, except that a do…

while loop is guaranteed to execute at least one time.

Page 9: Assignment C++ Programming

f) Jump / Loop The initialization statement is executed only once at the beginning

of the for loop. Then the test expression is checked by the program. If the test expression is false, for the loop is terminated. But if test expression is true then the code/s inside body of for loop is executed and then update expression is updated. This process repeats until test expression is false.

Page 10: Assignment C++ Programming

g) If / else An if statement can be followed by an optional else statement,

which executes when the Boolean expression is false.