assignment c++ adibah
DESCRIPTION
Assignment c++TRANSCRIPT
![Page 1: ASSIGNMENT C++ adibah](https://reader036.vdocuments.net/reader036/viewer/2022083016/5695d4f61a28ab9b02a37909/html5/thumbnails/1.jpg)
QUESTIONS
1. Who is Written C++ ?
Bjarne Strousstrup, a Danish computer scientist, began his work on C++'s predecessor "C with Classee" in 1979.The motivation for creating a new language originated from Stroustrup's experience in programming for his Ph.D. thesis. Stroustrup found that Simula had features that were very helpful for large software development, but the language was too slow for practical use, while BCPL was fast but too low-level to be suitable for large software development.
2. An example application in C++ Programminga) Go to
Use of goto statement is highly discouraged because it makes difficult
to trace the control flow of a program, making the program hard to
understand and hard to modify. Any program that uses a goto can be
rewritten so that it doesn't need the goto.
![Page 2: ASSIGNMENT C++ adibah](https://reader036.vdocuments.net/reader036/viewer/2022083016/5695d4f61a28ab9b02a37909/html5/thumbnails/2.jpg)
b) While
Unlike for and while loops, which test the loop condition at the top of the loop, the do...while loop checks its condition at the bottom of the loop.
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 3: ASSIGNMENT C++ adibah](https://reader036.vdocuments.net/reader036/viewer/2022083016/5695d4f61a28ab9b02a37909/html5/thumbnails/3.jpg)
c) Break and Continue
There are two statements (break; and continue;) built in C++ programming to alter the
normal flow of program.
Loops are used to perform repetitive task until test expression is false but sometimes it is
desirable to skip some statement/s inside loop or terminate the loop immediately with
checking test condition. On these type of scenarios, continue; statement
and break; statement is used respectively. Thebreak; statement is also used to terminate
switch statement.
![Page 4: ASSIGNMENT C++ adibah](https://reader036.vdocuments.net/reader036/viewer/2022083016/5695d4f61a28ab9b02a37909/html5/thumbnails/4.jpg)
d) While true
A while loop statement repeatedly executes a target statement as long as a given condition is true.
e) Do / While
The do-while loop is an exit-condition loop. This means that the code must always be executed first and then the expression or test condition is evaluated. If it is true, the code executes the body of the loop again
![Page 5: ASSIGNMENT C++ adibah](https://reader036.vdocuments.net/reader036/viewer/2022083016/5695d4f61a28ab9b02a37909/html5/thumbnails/5.jpg)
f) Jump / Loop
Loops are used to perform repetitive task until test expression is false but sometimes it is desirable to skip some statement/s inside loop or terminate the loop immediately with checking test condition. On these type of scenarios, continue; statement and break; statement is used respectively. Thebreak; statement is also used to terminate switch statement.
g) If / else
An if statement can be followed by an optional else statement, which executes when the boolean expression is false.
![Page 6: ASSIGNMENT C++ adibah](https://reader036.vdocuments.net/reader036/viewer/2022083016/5695d4f61a28ab9b02a37909/html5/thumbnails/6.jpg)