>and it confused me much, what cause it be ???
Your question confuses me much, what is the problem? Every time showX is called, x is set to 0, printed, incremented, and then printed again. Aside from your ghastly use of undefined behavior, this is correct and predictable.
Could you be more specific as to what output you were expecting?
/* Note that I had to change calls to cout,
** cin, and endl to include the namespace prefix
** since you don't have a using statement. I
** also changed the first call to cout so that it
** ends with a space to create the exact output
** from your post.
std::cout << x << ' ';
std::cout << x << std::endl;
// void main is wrong, main returns an int.