//'i' can be any number//Can be any comparison operater //can be any number compared//can be any mathmatic operaterfor(int i =0; i<100; i++){//Do thing}//more info on operaters//https://www.w3schools.com/cpp/cpp_operators.asp
for(int i =0; i <10; i++){//Do something as long as i is less than 10, //In that case it will loop 10 times//use break; to restart the loop whenever you want to cancel the loops.
cout << i;//at the end, remember i will be increased by 1.}//output 0123456789
//I think this is a better way for a for loop//for like going through arrays or something//hope you like it :)//be sure to do #include <set>intmain(){
set<char> letters ={'A','B','C'};for(auto itr = letters.begin(); itr != letters.end();++itr){
cout <<*itr << endl;}}
for( init; condition; increment ){statement(s);}
Example:for( i=0; i<5; i++){
cout<<"Hello World"<<endl;//Hello World is going to be print out 5 times}
// i doesn't have to be defined as i, it could be any letter or word// i < 10 means the code will loop 10 times before it ends// i always starts at 0 unless you define it// i++ means it increments by 1 every loop, can be any math functionfor(int i; i<10; i++){// Your code}// Great website to learn cpp: http://learn.onlinegdb.com/c%2B%2B_loops
// C program to illustrate need of loops#include<stdio.h>intmain(){printf( "Hello World
");printf( "Hello World
");printf( "Hello World
");printf( "Hello World
");printf( "Hello World
");printf( "Hello World
");printf( "Hello World
");printf( "Hello World
");printf( "Hello World
");printf( "Hello World
");return0;}
#defineFOR(x,a,b)for(int x = a; x <= b; x++)#defineFOD(x,a,b)for(int x = a; x >= b; x--)#defineREP(x,a,b)for(int x = a; x < b; x++)#defineRED(x,a,b)for(int x = a; x > b; x--)
//I think this is a better way for a for loop//for like going through arrays or something//hope you like it :)//be sure to do #include <set>intmain(){
set<char> letters ={'X','Y','Z'};for(auto itr = letters.begin(); itr != letters.end();++itr){
cout <<*itr << endl;}}