I am not understanding where to use for loop
You use a for loop when you know the number of operations you want to perform. For example, if you want to print all numbers from 0 to 100 then you will do: for(int i = 0 ; i <= 100 ; i++)cout << i << endl;