我是 C++ 新手,我在处理这段代码时遇到了问题:
string output_date(int day, int month, int year){
string date;
if ((day > 0 && day <= 30) && (month > 0 && month <= 12) && (year >= 2013)){
switch (month){
case 1: date = day + " JAN " + year; break;
case 2: date = day + " FEB " + year; break;
case 3: date = day + " MAR " + year; break;
case 4: date = day + " APR " + year; break;
case 5: date = day + " MAY " + year; break;
case 6: date = day + " JUN " + year; break;
case 7: date = day + " JUL " + year; break;
case 8: date = day + " AUG " + year; break;
case 9: date = day + " SEP " + year; break;
case 10: date = day + " OCT " + year; break;
case 11: date = day + " NOV " + year; break;
case 12: date = day + " DEC " + year; break;
}
}
return date;
}
当我尝试做:
cout << output_date(22,12,2013);
什么都没有出现。我究竟做错了什么?