Console in VS 2012 Express for C++?

Posted by Live2Code on Stack Overflow See other posts from Stack Overflow or by Live2Code
Published on 2013-06-27T16:07:06Z Indexed on 2013/06/27 16:21 UTC
Read the original article Hit count: 210

I'm very new to programming, so be nice.

I was using Eclipse for C/C++ devs for a while, but it seemed quite buggy so I was advised to switch to Visual Studio Express. I'm just testing out with a simple "Hello World" program

#include <iostream>
#include <string>
using namespace std;

int main( int argc, char ** argv )
{
    string response;
    cout << "Gimme a string: " << flush;
    cin >> response;
    cout << "The string is: " << response << endl;
    system("pause");
    return 0;
}

not much to go wrong there

anyway, I noticed that there is no "console" like in Eclipse. All of the text pops up in a little command prompt window. And, also, this window closes right after displaying new text if there is no other things to do after it (like a cin). I have been told that I can use system("pause") but there has to be a better way. In Eclipse, the text would not suddenly disappear because the console window closed.

i know this question might be a little confusing, comment and I'll try to explain what I'm saying. Or paste the codes into your Visual Studio 2012 Express Edition.

But is there a way to display all of my text and whatever in a "console" as opposed to a command prompt-type window; and why does it always close before I can read the last thing?

© Stack Overflow or respective owner

Related posts about c++

Related posts about visual-c++