Repetition of statements called itration and looping.
we are using three loops.
 
1-Do while Loop
2-While Loop
3-For Loop
 
if you want to Print Hello World 5 times.
you are using  cout 5 times.
 
Cout<<"Hello World;
Cout<<"Hello World;
Cout<<"Hello World;
Cout<<"Hello World;
Cout<<"Hello World;
 
but in the loop 
 
for ( i=1; i<=5 ; i++ )
{
cout<<"HelloWorld";
}
 
and now your Program run 5 times and your Message HelloWolrd are Printing.
 
Jawad 
PK 
 
 

--- On Tue, 4/21/09, Thomas Hruska <[email protected]> wrote:


From: Thomas Hruska <[email protected]>
Subject: Re: [c-prog] Re: explain me
To: [email protected]
Date: Tuesday, April 21, 2009, 1:58 PM








John Matthews wrote:
> --- In c-p...@yahoogroups. com, osho ratha <rathao...@. ..> wrote:
>> can you explain me what is the purpose of loop
>>
>> and what is loop in detail with example
> 
> C or C++? Trying googling for 'c++ control structures' - any use?

The purpose of a loop. Hmm. A good philosophical question.

Loops are a form of code maintenance. That is, they reduce the amount 
of logic that has to be maintained.

Some loops are cleanly designed and some aren't. The ones that aren't 
require additional logic to set up for the conditional stage (i.e. when 
to break out of the loop).

-- 
Thomas Hruska
CubicleSoft President
Ph: 517-803-4197

*NEW* MyTaskFocus 1.1
Get on task. Stay on task.

http://www.CubicleS oft.com/MyTaskFo cus/

















      

[Non-text portions of this message have been removed]

Reply via email to