Should i really need to master loops (while,for,do while) in C++ ?
I get it but when im trying some beginner exercises i cannot do it.
all i can do is looping numbers and its square.
Standard library does provide several algorithms that do loops on your behalf, but they do not apply to every situation. Furthermore, understanding the concept of iterative algorithm (aka loops) is extremely useful.
trust me you want to master them...thumb rule for loops:
While loop - use when number of executions(iteration) is unknown
for loop - use when number of executions is known, mostly use with arrays
do while - use when you want to execute some code once regardless
of your condition being true or false
you will use them with almost everything because 90% problems are logic based and there is no other way of doing them without loops and condition statements(if/else).