for Loop
This is the most widely used loop among C++ programmers.The general form of this is :
for(initialize variable ; check condition ; increment / decrements value)
{
Body of Loop
}
Its very easy to take down this topic.All you need is just a bit of practice.Lets begin with an example and then we'll be having a decent explanation of it.
#include<iostream>
#include<cstdlib>
using namespace std;
int main()
{
system("CLS");
for(int i=1;i<=5;i++)
{
cout<<"C++ is an awesome language."<<endl;
}
cout<<"We are out of loop."<<endl;
system("PAUSE");
}
Here's the output of our program.
Now we'll see how to evaluate the a 'for' loop and get the output.
<<Loops In C++ Home Evaluation Of Loop>>
No comments:
Post a Comment