今天写题本地测试时,cin、cout由于未知原因就挂了,具体如下图:

代码:
#include<bits/stdc++.h>
using namespace std;
int n;
string a[29];
int main()
{
ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
cin >> n;
for ( int i = 1 ; i <= n ; i++ ) cin >> a[i];
sort(a + 1, a + n + 1, [](string x, string y){
return x + y > y + x;
});
for ( int i = 1 ; i <= n ; i++ ) cout << a[i];
cout << endl;
return 0;
}
已知ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);不论是否注释都会产生这样的问题,而scanf、printf可正常使用
编译命令:g++ -std=c++2a -O2 -Wall file.cpp -o file.exe
运行环境:Windows10 64bit
有大佬知道是什么原因么?