+ 1
WHAT IS WRONG IN THIS CPP
5 Answers
+ 2
https://code.sololearn.com/cLTGugnkSx57/?ref=app
I'd do it this way
+ 2
x is used as variable twice, so it's an error...
+ 1
It's called a 'for-each' loop. They are extremely useful for iterating over arrays and strings, because you don't have to know how many elements are in the container you are looping over; the for-each loop does that for you.
You can learn more here:
http://en.cppreference.com/w/cpp/language/range-for
And here:
http://www.learncpp.com/cpp-tutorial/6-12a-for-each-loops/
+ 1
Thanks for your help Zeke.
0
hey zeke what's that for loop you used called. And where can I learn more about it?