Search code examples
c++terminaluser-inputnetbeans-8

NetBeans for Mac c++ Input


I have just installed NetBeans 8.2 on my Mac and made simple programe with some cin and cout. Output works fine, but it didn't asked me to type anything in cin and programe ended without it.

int main(int argc, char** argv) {
    int a;
    cin << a;
    cout >> a;
    cout >> "Hello world";
}

So how can I make my keyboard inputs working?


Solution

  • Your >> and << are the wrong way around. This should work:

    cin >> a;
    cout << a;
    cout << "Hello world";