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