We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
It's reading in a value from cin and assigning it to a previously declared variable named curInput. Each time the loop runs, it reads a variable value, assigns it to curInput, processes it accordingly, and then loops again until the loop is finished. Because the value of curInput is processed inside the loop and not needed again after processing, the value of curInput just gets overwritten at each cin >> curInput;.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Diagonal Difference
You are viewing a single comment's thread. Return to all comments →
It's reading in a value from
cin
and assigning it to a previously declared variable namedcurInput
. Each time the loop runs, it reads a variable value, assigns it tocurInput
, processes it accordingly, and then loops again until the loop is finished. Because the value ofcurInput
is processed inside the loop and not needed again after processing, the value ofcurInput
just gets overwritten at eachcin >> curInput;
.