error statement cannot resolve address of overloaded function

i have written this code for finding the day of week on any date but it is showing error statement cannot resolve address of overloaded function on lines 40 to 46.
#include<iostream>
using namespace std;

int main() {
int q,d,m,y,c,a,s,r,p;
cout<<"enter the year "<<endl;
cin>>a;
cout<<"enter the day of month";
cin>>d;
cout<<"enter the month number(1 to 12) ";
cin>>s;
p=a/100;
r=a%4;
if (r=0){c=6;}
else if (r==1){c=4;}
else if (r==2){c=2;}
else c=0;
y=a%100;
if(r=0){ if(s==1){m=-1;}
else if(s==2){m=2;}
else if (s==3||s==11){m=3;}
else if (s==4||s==7){m=6;}
else if (s==9||s==12){m=5;}
else if (s==10){m=0;}
else if (s==5){m=1;}
else if (s==8){m=2;}
else m=4;
}
else if(r!=0){ if(s==1){m=0;}
else if(s==2){m=3;}
else if (s==3||s==11){m=3;}
else if (s==4||s==7){m=6;}
else if (s==9||s==12){m=5;}
else if (s==10){m=0;}
else if (s==5){m=1;}
else if (s==8){m=2;}
else m=4;
}
q= (d+m+y+y/4+c)%7;
if (q==0){cout<<"the day on "<<d<<"/"<<s<<"/"<<a<<" is "<<"sunday";endl;
else if (q==1){cout<<"the day on "<<d<<"/"<<s<<"/"<<a<<" is "<<"monday";endl;}
else if (q==2){cout<<"the day on "<<d<<"/"<<s<<"/"<<a<<" is "<<"tuesday";endl;}
else if (q==3){cout<<"the day on "<<d<<"/"<<s<<"/"<<a<<" is "<<"wednesday";endl;}
else if (q==4){cout<<"the day on "<<d<<"/"<<s<<"/"<<a<<" is "<<"thrusday";endl;}
else if (q==5){cout<<"the day on "<<d<<"/"<<s<<"/"<<a<<" is "<<"friday";endl;}
else cout<<"the day on "<<d<<"/"<<s<<"/"<<a<<" is "<<"saturday";endl;}
return 0;
}



please help or else a new born coder will die soon!!!
Change all instances of ;endl; to << endl;.
Also, add closing curly } after
if (q==0){cout<<"the day on "<<d<<"/"<<s<<"/"<<a<<" is "<<"sunday";endl; }
statement, and remove curly just before return.
Last edited on
In these lines instead of for example

if (q==0){cout<<"the day on "<<d<<"/"<<s<<"/"<<a<<" is "<<"sunday";endl;

you should write

if (q==0){cout<<"the day on "<<d<<"/"<<s<<"/"<<a<<" is "<<"sunday" << endl;
thanks JockX and vlad from moscow , the code finally worked however it is not showing the correct day but atleast it worked. Thanks again
Topic archived. No new replies allowed.