我在使用Devc++编译运行的时候,结果显示不全,但是用Visual Studio运行又能显示全了?这是为什么?
#include <iostream>
#include <cstring>
using namespace std;
string str;
string month[12] = { "Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec" };
int main()
{
cin >> str;
for (int i = 1; i < 13; i++)
{
if (str.substr(0, 3) == month[i])
{
cout << i + 1 << " ";
}
}
if (str[3] != '0')
{
cout << str[3];
}
cout << str[4];
return 0;
}