COAP222uninitialized

This indicates a variable has been used before it was given a value. In the example below, x has no assignment before it is altered and used as the loop control variable.

code format="cpp"
 * 1) include

using namespace std;

int main {   int x;    while (x++ < 10) {       cout << "On loop no " << x  << "\n"; }   return 0; }

code Solution: use code int x = 0; code