Inputting a symbol in an integer variable

Правка en2, от 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?

Теги cin/cout, iostream, mingw, codeblocks

История

 
 
 
 
Правки
 
 
  Rev. Язык Кто Когда Δ Комментарий
en2 Английский Krktv 2016-04-27 23:11:38 37
en1 Английский Krktv 2016-04-27 13:55:48 523 Initial revision (published)