do while loop cpp code example Example 1: do while loop c++ do { statement(s); } while(condition); Example 2: While loop in c++ while (x != 0){ ... }