VS keeping console up

Alright I'm having a problem keeping the console up when writing c++ in VS Express 2013. I know a way to keep it open when running a hello world application is cin.get(). I added it in right before the return 0; but it still does not stay open.

The console will open and will stay open for me to enter the movie name, the 2 scores then it closes before I have a chance to read what the average score is. Is the cin.get() in the right place or should I use a different operation.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
  #include <iostream>
#include <string>
using namespace std;

int main()
{
	//Get the name of the movie (The Incredibles)
	string movie = "";
	cout << "What is the name of the movie?: \n";
	getline(cin, movie);

	//Get the Metascore (90)
	int metascore = 0;
	cout << "What is the Metascore rating for " << movie << "?\n";
	cin >> metascore;

	//Get the Tomatometer (97)
	int tomatometer = 0;
	cout << "What is the Tomatometer rating for " << movie << "?\n";
	cin >> tomatometer;

	//Calculate the average
	double avg = (double)(metascore + tomatometer) / 2;

	//Rescale average
	double rescaledScore = avg / 10;

	//Display the result of the calculation
	cout << "Our calculated average on a 10 point scale for "
	<< movie << "is" << rescaledScore << ".";

	cin.get();
	
	return 0;
}
Zhuge I believe that is for older IDE. VS Express 2013 should have an option under project settings to keep the console open. I personally use code::blocks but I know vs 2012 has the option to keep console open and I don't see why vs 2013 wouldn't.

[edit]another thing are you running in debug or did you do the "run without debugging" option? I think the shortcut for "running without debug" is ctrl-f5.

[edit2]one more method is to possibly put a breakpoint right before returning in the main function.
Last edited on
Ill try both, that article and finding the setting to keep the console open. When I run my program I run jt with the debug I believe. I click the play button as a shortcut and I believe the default is run with debugging
Topic archived. No new replies allowed.