When using your own namespaces it needs to be namespace::variable/function. The method you are using in main is for structs or classes. You need to do:
#include <iostream>
usingnamespace std;
namespace date{
int day, month, year;
void setDate(int x, int y, int z) { day = x; month = y; year = z;}
}
int main()
{
int dday, mmonth, yyear;
cin >> dday >> mmonth >> yyear;
date::setDate(dday, mmonth, yyear);
cout << date::day << '/' << date::month << '/' << date::year << endl;
return 0;
}
I could have used your code, but figured I'd use the function and then print out the data you enter just to make sure all of your namespace was used. I hope that helps.