title: Grade checking program keeps auto exiting prematurely
body: <p>I am currently trying to learn C++ and I have written the following program. It does what it should successfully, however it keeps auto exiting. I have tried putting a <code>cin</code> at the end and when that didn't work I put a <code>getChar()</code> and it doesn't wait for any input. To be clear, I have had no formal education regarding C++ and this problem has had me stumped. I have tried googling it but all that comes up is it telling me to use either of the things I have already tried. I have commented out the <code>cin</code> breakpoints to show where I put them.</p>
  
  <p>As I said earlier, the actual code for the program is below. Underneath that is the debug log.</p>
  
  <p>For what it's worth, I used Visual Studio to make this.</p>
  
  <p><strong>Edit</strong>: This isn't a duplicate question as I want to be able to go the actual executable, double click it and get it to wait for me to press a key until it exits. With this program even if I go to the actual executable, it still auto exits.</p>
  
  <h2>Code</h2>
  
  <p>Code for the program:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;string&gt;
  using namespace std;
  
  // Declare variables for intro
  string intro = "Please enter your score.\n";
  string prompt = "&gt;&gt;&gt; ";
  string nl = "\n";
  
  // Declare grade calculation variables
  int initial_grade = 0;
  bool temp;
  
  // Declare variables for perfection test
  string perfect_score = "You scored perfectly, congratulations!\n";
  
  void perfection_test() {
      switch (initial_grade) {
      case 100:
          cout &lt;&lt; perfect_score;
          //cin;
      }
      //cin;
  
  }
  
  int main() {
      cout &lt;&lt; intro &lt;&lt; prompt;
      cin &gt;&gt; initial_grade;
      cout &lt;&lt; nl;
  
      //cin;
      perfection_test();
      //cin;
  }
  </code></pre>
  
  <p>Debug:</p>
  
  <pre><code>'GradingProgram.exe' (Win32): Loaded 'C:\Users\student\Desktop\khush\GradingProgram\Debug\GradingProgram.exe'. Symbols loaded.
  'GradingProgram.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ntdll.dll'. Cannot find or open the PDB file.
  'GradingProgram.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel32.dll'. Cannot find or open the PDB file.
  'GradingProgram.exe' (Win32): Loaded 'C:\Windows\SysWOW64\KernelBase.dll'. Cannot find or open the PDB file.
  'GradingProgram.exe' (Win32): Loaded 'C:\Windows\SysWOW64\vcruntime140d.dll'. Cannot find or open the PDB file.
  'GradingProgram.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcp140d.dll'. Cannot find or open the PDB file.
  'GradingProgram.exe' (Win32): Loaded 'C:\Windows\SysWOW64\advapi32.dll'. Cannot find or open the PDB file.
  'GradingProgram.exe' (Win32): Loaded 'C:\Windows\SysWOW64\ucrtbased.dll'. Cannot find or open the PDB file.
  'GradingProgram.exe' (Win32): Loaded 'C:\Windows\SysWOW64\msvcrt.dll'. Cannot find or open the PDB file.
  'GradingProgram.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sechost.dll'. Cannot find or open the PDB file.
  'GradingProgram.exe' (Win32): Loaded 'C:\Windows\SysWOW64\rpcrt4.dll'. Cannot find or open the PDB file.
  'GradingProgram.exe' (Win32): Loaded 'C:\Windows\SysWOW64\sspicli.dll'. Cannot find or open the PDB file.
  'GradingProgram.exe' (Win32): Loaded 'C:\Windows\SysWOW64\cryptbase.dll'. Cannot find or open the PDB file.
  'GradingProgram.exe' (Win32): Loaded 'C:\Windows\SysWOW64\bcryptprimitives.dll'. Cannot find or open the PDB file.
  'GradingProgram.exe' (Win32): Loaded 'C:\Windows\SysWOW64\kernel.appcore.dll'. Cannot find or open the PDB file.
  The thread 0x134c has exited with code 0 (0x0).
  The thread 0x2110 has exited with code 0 (0x0).
  The thread 0x210c has exited with code 0 (0x0).
  The program '[9092] GradingProgram.exe' has exited with code 0 (0x0).
  </code></pre>