Create a program that will ask the user to input his/her birth month and birth date. The program should display the ZODIAC SIGN and its description based on his/her input month and date.
Use the table of Zodiac Sign below:
AQUARIUS - January 20 – February 18
PISCES - February 19 – March 20
ARIES - March 21 – April 19
TAURUS - April 20 – May 20
GEMINI May 21 – June 20
CANCER June 21 – July 22
LEO July 23 – August 22
VIRGO August 23 – September 22
LIBRA September 23 – October 22
SCORPIO October 23 – November 21
SAGUITTARIUS November 22 – December 21
CAPRICORN December 22 – January 19
Sample Output:
Enter your Birth month: 12
Enter your Birth date: 03
** Your Zodiac Sign is SAGUITTARIUS..
(And the description of SAGUITTARIUS)
and also the program should continue asking the user if he/she wants to test another input.
what codes should i use? i don't even know where to start..thanks guys!!
Since the program may possibly have to run again aka LOOP then you'll need a looping mechanism. I'm sure you can figure out if you play around with it. That's the quickest way to learn.
#include <iostream>
using namespace std;
int main(int argc, const char * argv[])
{
int date;
int month;
char ans;
cout<<"Enter the Date and Month:"<<endl;
while (!((ans=='n')&&(ans=='N'))){
cout<<"Enter the Date:"<<endl;
cin>>date;
cout<<"Enter the Month:"<<endl;
cin>>month;
if ((date>=20 && date<31 && month==1)||(date<=18 && date>=1 && month==2)){
cout<<"Your Zodiac Sign is AQUARIUS.."<<endl;
}
else if ((date>=19 && date<31 && month==2)||(date<=20 && date>=1 && month==3)) {
cout<<"Your Zodiac Sign is PISCES.."<<endl;
}
else if ((date>=21 && date<31 && month==3)||(date<=19 && date>=1 && month==4)) {
cout<<"Your Zodiac Sign is ARIES.."<<endl;
}
else if ((date>=20 && date<31 && month==4)||(date<=20 && date>=1 && month==5)) {
cout<<"Your Zodiac Sign is TAURUS.."<<endl;
}
else if ((date>=21 && date<31 && month==5)||(date<=20 && date>=1 && month==6)) {
cout<<"Your Zodiac Sign is GEMINI.."<<endl;
}
else if ((date>=21 && date<31 && month==6)||(date<=22 && date>=1 && month==7)) {
cout<<"Your Zodiac Sign is CANCER.."<<endl;
}
else if ((date>=23 && date<31 && month==7)||(date<=22 && date>=1 && month==8)) {
cout<<"Your Zodiac Sign is LEO.."<<endl;
}
else if ((date>=23 && date<31 && month==8)||(date<=22 && date>=1 && month==9)) {
cout<<"Your Zodiac Sign is VIRGO.."<<endl;
}
else if ((date>=23 && date<31 && month==9)||(date<=22 && date>=1 && month==10)) {
cout<<"Your Zodiac Sign is LIBRA.."<<endl;
}
else if ((date>=23 && date<31 && month==10)||(date<=21 && date>=1 && month==11)) {
cout<<"Your Zodiac Sign is SCORPIO.."<<endl;
}
else if ((date>=22 && date<31 && month==11)||(date<=21 && date>=1 && month==12)) {
cout<<"Your Zodiac Sign is SAGUITTARIUS.."<<endl;
}
else if ((date>=22 && date<31 && month==12)||(date<=19 && date>=1 && month==1)) {
cout<<"Your Zodiac Sign is CAPRICORN.."<<endl;
}
else {
cout<<"You Have entered wrong input"<<endl;
}
cout<<"do you ant to cntinue? Y/N"<<endl;
cin>>ans;
}return 0;