Hi everyone ,:)

I need a function in c++ to calculat the age of a user, by asking the user to enter his birthday.
:S

Recommended Answers

All 2 Replies

#define CurrentYear 2009

int CountAge(int Year)
{
	int AgesOld = CurrentYear - Year;
	return AgesOld;
}

Thats the simplest way, you can also get system date and calculate it that way and be more accurate :)

>I need a function in c++ to calculat the age of a user, by asking the user to
>enter his birthday.
I think you're confusing this forum with the one who give away code.
Read the forum announcement. We help only those who show efforts.

What have you tried so far?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.