can someone tell me whats wrong with this codes, because there's some error in printing..


struct bday{
	char month[2];
	char date[2];
	char year[4];

struct contacts{
	char surname[10];
	char phoneno[12];

void main(void)
	struct contacts con[2];
	struct bday bd[2];
	int i;

		cout<<"\nSurname       : ";
		cout<<"Phone number  : ";
		cout<<"Birthday month: ";
		cout<<"Birthday date : ";
		cout<<"Birthday year : ";

		cout<<"\nContact #"<<i<<"surname     :"<<con[i].surname;
		cout<<"\nContact #"<<i<<"phone number: "<<con[i].phoneno;
		cout<<"\nContact #"<<i<<"Birthday    : "<<bd[i].month<<"/"<<bd[i].date<<"/"<<bd[i].year;

That will print 3 structures, not 2. what you want to do is use the < operator, not the <= operator.

My assumption (since I've been up all night that's all I'm going to do now) is that it's in print, it's in saving.

Your initializations of con and bd should simply be contacts con[2]; and bday bd[2]; . Also, you are trying to save 3 contacts yet you only initialize your arrays for 2. Either change your arrays to 3 or set your for so they run till i < 2.

No void main. Main should be int and returns 0 if it works. You can cause some big issues with void I've heard. More on it here: is slightly working now..
the struct bday has an error in should print like this 02/05/2009 but it prints like this 02052009/0205/2009..
can you tell me the problems

The structure is wrong -- need to add another character to each element for the null-terminator

struct bday{
	char month[3];
	char date[3];
	char year[5];

or just make them ints

struct bday{
	int month;
	int date;
	int year;