Inputting a symbol in an integer variable

Revision en2, by Krktv, 2016-04-27 23:11:38

Hey codeforces! One day I launched MinGW Studio and checked this simple code:

#include <iostream>
using namespace std;
int main() {
    int n = 50;
    cin >> n;
    cout << n;
    return 0;
}

I wrote 'z' on the console and saw '50'. Nothing strange. But when I did the same on the last version of CodeBlocks, I saw '0'. Can someone explain me what exactly happens in there and why it happens in CodeBlocks and doesn't happen in MinGW Studio?

Tags cin/cout, iostream, mingw, codeblocks

History

 
 
 
 
Revisions
 
 
  Rev. Lang. By When Δ Comment
en2 English Krktv 2016-04-27 23:11:38 37
en1 English Krktv 2016-04-27 13:55:48 523 Initial revision (published)