Bug on cout C++

Problem description:

Can someone explain to me why the code I wrote at the following link works correctly? I wrote an output statement on an integer variable before assigning a value to it. Despite the serious logical error, the program displays the value of the variable as if the assignment had been made before the output.

https://replit.com/@tommasogiorni3/Bug-on-cout

Expected behavior:

Actual behavior:

Steps to reproduce:

Bug appears at this link:

https://replit.com/@tommasogiorni3/Bug-on-cout

Browser:
OS:
Device (Android, iOS, NA leave blank):
Desktop app version (Avatar menu->“Version”) or NA:
Plan (Free, Hacker, Pro Plan):

A post was merged into an existing topic: C++ Errors getting ignored