我收到错误"在#34之前预期的主要表达;否则""在这部分代码中。但是我无法找到解决方案。任何帮助将不胜感激。
//create class Date object today
Date today (monthT, dayT, yearT);
// check today date that it is correct
if(!(today.checkDate(monthT, dayT, yearT)))
cout << "Today's date is wrong!" << endl;
return 0;
else
//increment date to get tomorrow
cout << "Tomorrow is " << monthT << ", " << dayT+1 << ", " << yearT << "." << endl;
答案 0 :(得分:3)
你错过了大括号:
//create class Date object today
Date today (monthT, dayT, yearT);
// check today date that it is correct
if(!(today.checkDate(monthT, dayT, yearT))) { //<---
cout << "Today's date is wrong!" << endl;
return 0;
} else //<---
//increment date to get tomorrow
cout << "Tomorrow is " << monthT << ", " << dayT+1 << ", " << yearT << "." << endl;