954,500 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

zodiac sign calculations

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.

info04
Newbie Poster
2 posts since Apr 2008
Reputation Points: 10
Solved Threads: 0
 

>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.

Narue
Bad Cop
Administrator
15,460 posts since Sep 2004
Reputation Points: 6,464
Solved Threads: 1,401
 

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..

asuraclass
Newbie Poster
1 post since Sep 2009
Reputation Points: 9
Solved Threads: 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";
	 }
mayanksinghmax
Newbie Poster
1 post since Feb 2010
Reputation Points: 2
Solved Threads: 0
 

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

Pls.. i need your.. thanks!

CECS
Newbie Poster
1 post since Mar 2011
Reputation Points: 7
Solved Threads: 0
 

This article has been dead for over three months

Post: Markdown Syntax: Formatting Help
You