You are right, all values of deck are 0 at the beginning and the loop works because the do{}while(condition);
is executing at least once before checking condition
. The loop is looking here for the first uninitialized card.
Duplicate output is just what the loop is currently checking, it finds an initialized card so it keeps looking for an uninitialized one (this is the first cout).
2
solved Need Help to understand the do while loop in details