Console closes Visual Studio

I'm a begginer and i wnat to know if at Visual Studio 2012 exist any setting to stop the console, i usually use the "getchar()", but it give me problems with the "while" thing. I dont want "System"PAUSE"" nor Start without debugging. i want the console to close when i press enter without put in danger my projects :/

Or tell me if the "while" have any special condition to "getchar ()"

#include <iostream>
using namespace std;
int main ()
int n;
cout << "Enter a number : ";
cin >> n;
while (n>0)
cout << n << ", ";
cout << "End\n";
return 0;
I like to use the getchar but what can i do in the program to fix the getchar() problem?
Topic archived. No new replies allowed.