functions

I need to write a function called printDate that takes a single record of the type Date as a parameter and returns nothing. The function should display the contents of the input record, using cout. I'm not sure how to do this because I don't understand how to create a function.
Thank you! ok so i have come up with this

#include <iostream>

using namespace std;

void printDate ( int day, int month, int year)
{


but now how do i get it to display the input record using cout?
can I do this instead

struct printDate {
int day;
int month;
int year;
};

if so how do I continue from here?
that really didn't help
closed account (iw0XoG1T)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include<iostream>
using namespace std;

struct printDate {
    printDate(int d, int m, int y):
        day(d),month(m),year(y){}
    int day;
    int month;
    int year;
};

int main(){

    printDate adate(25,11,2009);
    cout<<adate.month<<'/'<<adate.day<<'/'<<adate.year<<endl;
    return 0;
}
Thank you!

Now I have a problem with the numbers it outputs. They are not what I tell it but always 24/32/6.
closed account (iw0XoG1T)
post your code using:

[code]...here is where you should put your code....[/code].
Topic archived. No new replies allowed.