当我尝试运行我的 C++ 程序时会产生一个错误:
#include <iostream>
#include <ctime> //standard c++ library of time.h
using namespace std;
class DateCplusplus{
private:
int _day, _month, _year; //define variable
public:
void readValues(){
cout<<"Enter the day value: ";
cin>>_day;
cout<<"\nEnter the month value: ";
cin>>_month;
cout>>_year;
_year = _year - 1900;
}
int verifyValues(){
if(_day>=1 && _day <=31 && _month>=1 && _month<= 12){
return 1;
}
return 0;
}
int compareValues(){
time_t now = time(0);
tm *ltm = localtime(&now);
if((_year == ltm -> tm_year) && (_month ==1 +ltm -> tm_mon) && (_day == ltm -> tm_mday)){
return 1;
}
return 0;
}
int main(){
DateCplusplus date;
date.readValues();
cout<<"\nVerification of day and months values: "<<date.verifyValues()<<"\n";
cout<<"\nComparision of the day, the month and the year with the System current Date: "<<date.compareValues();
return 0;
}
};
终端中显示的错误是:/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/istream:1634:1:注意:候选模板被忽略:无法匹配'basic_istream ' 针对 'basic_ostream' 运算符>>(basic_istream<_CharT, _Traits>& __is, bitset<_Size>& __x)
你能帮我找出我的错误吗?
谢谢!