The list is not small...
To start with, when you get an error,
tell us what it is - that means give us the error message, tell us where it occurs, and how you get it to happen.
It's also a good idea to tell us which compiler you are using as we have no idea...
But...when I try an online C++ compiler, it gives many errors:
void inputdate(mydate &t)
{
mydate t;
The declaration of a local variable
t
shadows the parameter of the same name: which means you cannot access the parameter at all, so why have it? At a guess, you should remove the local declaration completely, and use the parameter.
class mydate
{
int d,m,y;
And
cin>>t.d>>t.m>>t.y;
Since you don't specify an access for the variables when you declare them, they are
private
by default: so you can't access them from outside the class itself. Since the
inputdate
function is not a part of the
mydate
class, it can't access private members. It doesn;t share the same signature as the
friend
function declared in the class:
class mydate
{
...
friend void inputdate();
...
};
void inputdate(mydate &t)
So it isn't able to access
private
data.
Either remove the parameter from the function definition, or add it to the
friend
function declaration.
And forget that
goto
even exists. Remove it from all your code immediately, and do =not attempt to use it for at least five years - by which time you will have enough experience to understand why you shouldn't be using it for trivial code like this, and when it is appropriate to use it. Use loops such as
while
or
do ...while
instead.