mercredi 7 novembre 2018

How can I correct my program and make it display the initial time as intended

I'm trying to make a programming that would set the time to 11/7/2018, but it's not working. It only display 4 errors. Can someone please help me rectify the code.

#include <iostream>
using namespace std;
class date {
private: 
int day,month,year;
public:void advance();
date(){
    day=1;
    month=1;
    year=2018;
};
void setDate(){
cout<<date<<"/"<<month<<"/"<<year<<endl;
}
};

void date::advance(){
for(month=1;month=12;month++){
for(day=1;day=31;day++){
cout<<date<<"/"<<month<<"/"<<year<<endl;
}   
}
}
int main(){
date d;
cout<<"Date set as:";
d.setDate();
cout<<"Setting the advance method"<<endl;
d.advance();
return 0;
}

It display In member function 'void date::setDate()':
[Error] expected primary-expression before '<<' token
In member function 'void date::advance()':
[Error] expected primary-expression before '<<' token

Aucun commentaire:

Enregistrer un commentaire