Search for notes by fellow students, in your own course and all over the country.

Browse our notes for titles which look like what you need, you can preview any of the notes via a sample of the contents. After you're happy these are the notes you're after simply pop them into your shopping cart.

My Basket

You have nothing in your shopping cart yet.

Title: C++ Loops
Description: Learn loops in this note with some program examples and excited way to know how to draw flowchart for loops

Document Preview

Extracts from the notes are below, to see the PDF you'll receive please use the links above


1
...
Functions

Loops
For loop: All is written in one sentence
...

2) Write a C++ program that prints “Hello” and also “*” five times
...


While loop: While loop is different from for loop, for loop is the simplest loop in C++ , while
loop should be initialized first out from the loop and then we put the condition
and the update inside the loop
...

Sample run :0 , 5 ,10 ,15 ,20
2) Write a C++ program that add specific number of integers added by the
user
...


Do
...


Loop form: Do {
Statement
update
}
While (condition);

Flowchart: start

statment

condition

end

Exercise: Write a C++ program that prints 0, 5, 10, 15, 20 and run at least one time
...


Ex
...

Answer: int x, y = 0;
cin >> x;
while (x != -1) {
y += x;
cin >> x;
}
cout << y << endl;

Random: Random generate a number from the computer but the programmer control the
interval of this number and also control the number of random number displayed
on the screen for the user through a lot of things that is in the code the
programmer write
...
every time we run

The random code: Srand(time(0));
Num=rand()%100;

Break, continue
...


Nested loop: Write a C++ program to print this shape
Title: C++ Loops
Description: Learn loops in this note with some program examples and excited way to know how to draw flowchart for loops