从美国格式转换为国际格式的日期 请大神指点
# include <iostream># include <string>
using namespace std;
int main ()
{
cout << "Enter the date in American foemat" <<"(e.g.,December 29,1953):";
string Date;
getline (cin,Date,i\ni);
int i =Date.find( " ");
string Month = Date.substr (0,i);
int k =Date.find(".");
string Day = Date.substr ( i+1 ,k-i-1);
string Year =Date.substr (k+2,Date.size());
string NewDate = Day + " "+Month+" "+Year;
cout << "Original date :" << Date << endl;
cout <<"Converted date :" << NewDate << endl ;
return 0;
}
未知错误,运行不出来。
error C2065: “i”: 未声明的标识符
error C2146: 语法错误 : 缺少“)”(在标识符“ni”的前面)
error C2059: 语法错误 : “)”