Make a program that will accepts two numbers (first number is for birth month, second number is for birth date) and display its zodiac sign using combined equality and logical operators.
#include <iostream>
using namespace std;
int main()
{
int zodiac,day, month;
cout << "Enter month: ";
cin >> month;
cout << "Enter day: ";
cin >> day;
zodiac=100*month+day;
if(zodiac>=121 && zodiac<=219) cout<<"Aquarius \n" ;
if(zodiac>=220 && zodiac<=320) cout<<"Pisces \n";
if(zodiac>=321 && zodiac<=420) cout<<"Aries \n";
if(zodiac>=421 && zodiac<=521) cout<<"Taurus \n";
if(zodiac>=522 && zodiac<=621) cout<<"Gemini \n";
if(zodiac>=621 && zodiac<=722) cout<<"Cancer \n";
if(zodiac>=723 && zodiac<=823) cout<<"Leo \n";
if(zodiac>=824 && zodiac<=923) cout<<"Virgo \n";
if(zodiac>=924 && zodiac<=1023) cout<<"Libra \n";
if(zodiac>=1024 && zodiac<=1122) cout<<"Scorpio \n";
if(zodiac>=1123 && zodiac<=1221) cout<<"Sagittarius \n";
if(zodiac>=1222 || zodiac<=120) cout<<"Capricorn \n";
return 0;
}
Comments
Leave a comment