Answer to Question #335674 in C++ for Kate

Question #335674

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.


1
Expert's answer
2022-04-30T05:39:35-0400
#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;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS