Return 0; Is not Working

1
2
3
4
5
6
7
8
9
10
11
12
// conditional operator
#include <iostream>
using namespace std; 
int main () 
{ 
  int a,b,c; 
  a=2; 
  b=7; 
  c = (a>b) ? a : b; 
  cout << c; 
  return 0; 
}

As you see here I have no errors at all and it keeps on skipping the cmd instead of showing it for more than 1 second. Whats the problem, am I missing something?
On windows the console window automatically shut down when the program ends. I think you can change some settings to make it stay open. If you run it from an IDE there is probably some IDE settings you change. If you first open the command prompt and start the program from there you will also be able to see the output.
Last edited on
My IDE is Dev-C++.
try ctrl F5
There's a big sticky about this:

http://cplusplus.com/forum/beginner/1988/
^ Did Not Work :( ^
1
2
3
cout << c;
cin.get(); // <-
return 0;
Topic archived. No new replies allowed.