Program ends before producing any output.

Hi. My program compiles, but when I run it, it immediately closes without producing any output or getting any input from the user. It's a fairly simple step, but I can't figure out what's wrong with it. Thank you so much for the help.

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
36
37
#include <iostream>
using namespace std;
#include <string>

int main()
{

//Declare variables for input.
string i;
string d = "fileContainingEmails.txt";

//Prompt and gather input file.
cout << "Enter input file name. [Default: " << d << " ]";
getline(cin, i);

if(i == " ")
  i = d;

//Declare variables for output.
string o;
string d2 = "copyPasteMyEmails.txt";

if(i != d)
  d2 = i;

//Prompt and gather output file.
cout << "Enter output file name. [Default: " << d2 << " ]";
getline(cin,o);

if(o == " ")
  o = d2;
  
cout << "Input file: " << i << endl;

cout << "Output file: " << o << endl;

}


Also, I'm not supposed to open the files yet so I know that I didn't open them.
It works for me

1
2
3
4
5
C:\Temp>test
Enter input file name. [Default: fileContainingEmails.txt ]out.txt
Enter output file name. [Default: out.txt ]out1.txt
Input file: out.txt
Output file: out1.txt
Topic archived. No new replies allowed.