while loops in depth c++ code example Example 1: While loop in c++ while (x != 0){ ... } Example 2: While loop in c++ while (x){ ... }