Code works in one compiler but not another

Hi everyone. When I run this code in Xcode it works as it is supposed to. When my friend runs it in Visual Studio, the program gets the phrase from the user but then immediately closes. In particular, when my friend runs this code neither the phrase in the if block nor the else if block is printed to the screen. Is there something in my friend's Visual Studio settings that is causing this?

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
  #include <iostream>
#include <string>

using namespace std;

int main () {
	
	int dummy;
	string x;
	int y;

	cout<<"Please insert a phrase.";
	cin>>x;

	cout<<x;

	y = x.length();

	if (y <= 3)
		cout<<"Your phrase started with a short word.";
	else if (y > 3)
		cout<<"Your phrase started with a long word.";

	cin>>dummy;

	return 0;
}
Topic archived. No new replies allowed.