I want to write a program that asks the user to enter his date of birth and print the zodiac sign on the screen. The program should allow the user to enter his date of birth in the MM/DD/YYYY format. The program should also print the user's age on the console. The age format should be : You are 26 years, 4 months and 7 days old.
I must use if, else and/or Switch statements ONLY.

Any help will be highly appreciated.

Thanks in advance.

Recommended Answers

All 4 Replies

>The program should also print the user's age on the console.
Are you expected to take into account leap years? I don't see a naive implementation being much trouble, so you'll need to post your attempt before I give you any significant help.

bro can you make an format that will know what is your zodiak sign?
like the user must enter the following month,year,day
then the output wll be your zodiak sign.. can you make it for me thanks and if it is done please sent it to my e mail SNIP
thangks more power..

commented: This threads last post was in 2008. Please donot wake up dead posts. -1
commented: you've been a member long enough, and this is your first post, you should know better... +0
#include<iostream.h>
void main()
{
	int dob,mob,yob,days,t_y,t_d,t_m,a,c_y;
	char nam[100];
	cout<<"enter your name";
	cin>>nam;
	cout<<"\n"<<"enter your month of birth:";
	cin>>mob;
	cout<<"\n"<<"enter your date of birth";
	cin>>dob;
	cout<<"\n"<<"enter your year of birth:";
	cin>>yob;
	cout<<"\n"<<"enter the current year";
	cin>>c_y;
	cout<<"\n"<<"enter the no. of days in your mob";
	cin>>a;
	if((yob>1985&&yob<2020))
{
	if((dob>=21&&dob<=31&&mob==3)||(dob>=1&&dob<=20&&mob==4))
	{
		cout<<"aries";
	}
	if((dob>=21&&dob<=30&&mob==4)||(dob>=1&&dob<=21&&mob==5))
	{
		cout<<"jaurus";
	}
    if((dob>=22&&dob<=31&&mob==5)||(dob>=1&&dob<=21&&mob==6))
	{
		cout<<"gemini";
	}
	if((dob>=22&&dob<=30&&mob==6)||(dob>=1&&dob<=22&&mob==7))
	{
		cout<<"cahur";
	}
	if((dob>=23&&dob<=31&&mob==7)||(dob>=1&&dob<=23&&mob==8))
	{
		cout<<"leo";
	}
	if((dob>=24&&dob<=31&&mob==8)||(dob>=1&&dob<=23&&mob==9))
	{
		cout<<"virgo";
	}
	if((dob>=24&&dob<=30&&mob==9)||(dob>=1&&dob<=23&&mob==10))
	{
		cout<<"libra";
	}
	if((dob>=24&&dob<=31&&mob==10)||(dob>=1&&dob<=22&&mob==11))
	{
		cout<<"scorpio";
	}
	if((dob>=23&&dob<=30&&mob==11)||(dob>=1&&dob<=23&&mob==12))
	{
		cout<<"sagitorus";
	}
	if((dob>=24&&dob<=31&&mob==12)||(dob>=1&&dob<=20&&mob==1))
	{
		cout<<"capicorn";
	}
    if((dob>=21&&dob<=31&&mob==1)||(dob>=1&&dob<=19&&mob==2))
	{
		cout<<"aquarius";
	}

 	if((dob>=20&&dob<=29&&mob==2)||(dob>=1&&dob<=20&&mob==3))
	{
		cout<<"picses";
	}
}
else
{
	cout<<"sorry,no information";
}
 t_y=(c_y)-(yob+1);
 t_m=(12-mob)+(mob-1);
 t_d=(a-dob);
 cout<<"your age is"<<t_y<<"yrs"<<"\n"<<t_m<<"months"<<"\n"<<t_d<<"days";
	 }
commented: Too late to be of any use, written for a compiler too old to be of any use, and lacking code tags -4
commented: What a waste of your first post. -4

hi! can you also give me the algorithm and the flow chart?

Pls.. i need your.. thanks!

commented: Begging us to do your homework for you, eh? -3
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.