Solution for Problem 2 :

Output is always 7 6.

PS : You have used void main(...), which will give an error on compilation with latest ANSI C++; but might be OK with Turbo C++.